mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[11155] Provide way define UNIX_TIMESTAMP/FROM_UNIXTIME for PosgreSQL users.
If mangos build for use Postgre SQL server Queries from sql/postgre_compatibility_addon.sql must be used at least one time for each mangos DB part stored in Postgre SQL server. File constent based at article in http://janusz.slota.name/blog/ Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
f6affaf406
commit
f31a2d3d84
2 changed files with 23 additions and 1 deletions
22
sql/postgre_compatibility_addon.sql
Normal file
22
sql/postgre_compatibility_addon.sql
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- This queries for users PostgreSQL.
|
||||
--
|
||||
-- Its need apply single time after DB creating or later (safe reapply)
|
||||
-- and let correctly execute SQL queries with UNIX_TIMESTAMP/FROM_UNIXTIME
|
||||
-- functions uses in mangosd/realmd code.
|
||||
|
||||
-- NOTE: Queries must be applied to each mangos DB parts: mangos, characters, realmd at least one time.
|
||||
|
||||
-- no params
|
||||
CREATE OR REPLACE FUNCTION unix_timestamp() RETURNS bigint AS '
|
||||
SELECT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP(0))::bigint AS result;
|
||||
' LANGUAGE 'SQL';
|
||||
|
||||
-- timestamp without time zone (i.e. 1973-11-29 21:33:09)
|
||||
CREATE OR REPLACE FUNCTION unix_timestamp(timestamp) RETURNS bigint AS '
|
||||
SELECT EXTRACT(EPOCH FROM $1)::bigint AS result;
|
||||
' LANGUAGE 'SQL';
|
||||
|
||||
-- timestamp with time zone (i.e. 1973-11-29 21:33:09+01)
|
||||
CREATE OR REPLACE FUNCTION unix_timestamp(timestamp WITH time zone) RETURNS bigint AS '
|
||||
SELECT EXTRACT(EPOCH FROM $1)::bigint AS result;
|
||||
' LANGUAGE 'SQL';
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11154"
|
||||
#define REVISION_NR "11155"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue