mangosArchives / Mangos-One-server-old

This repo has been moved to https://githubs.com/mangosone/server
http://getmangos.eu/
GNU General Public License v2.0
95 stars 54 forks source link

Postgresql: function UNIX_TIMESTAMP() doesnt exist #1

Closed m4tm4t closed 13 years ago

m4tm4t commented 13 years ago

DBErrors.log: https://gist.github.com/823261

I have fix realmd related queries and work fine https://gist.github.com/823286

UNIX_TIMESTAMP() simply replaced by round(date_part('epoch',now()))

If it's a good fix I can make patch for all queries

Ambal commented 13 years ago

oh, so someone is still using postgre?.. yes, please, provide a fix for postgre if you can

VladimirMangos commented 13 years ago

Strange, it used long time in master version directly in code and none one report porblems when some other porblems has been reported about posgre use.

VladimirMangos commented 13 years ago

"If it's a good fix I can make patch for all queries"

No-no, this is not right way...

We have some other syntax diff in queries for mysql/posgre and have special defines for provide alternative syntax. If you confirm that this work right i can add like define for in all places use instead direct UNIX_TIMESTAMP But we also use FROM_UNIXTIME(time). Is it ok case?

m4tm4t commented 13 years ago

found http://janusz.slota.name/blog/2009/06/mysql-from_unixtime-and-unix_timestamp-functions-in-postgresql/

Tested as postgres function and work then what the best, postgres functions or core modification?

VladimirMangos commented 13 years ago

Hmm, intresting sollution, if function psosible then maybe better have its. As i understand then need do add its query in posrgre database connection init? it need do for each connection or single time. in any case this need do then in PostgreSQLConnection::Initialize possible. Can you test this way? And maybe provide patch if work....

m4tm4t commented 13 years ago

Function replacement need to be added one time at each database using FROM_UNIXTIME and UNIX_TIMESTAMP http://www.picdo.net/fichiers/2011/2/12/05ca3557-7ecb-4e0d-b24d-e9a14261671b_pgfunctions.tiff

VladimirMangos commented 13 years ago

Fixed in [11155] in suggested way. Please look is i ok write because can't do real test in PostgreSQL.

m4tm4t commented 13 years ago

it works but you have forget the function FROM_UNIXTIME https://gist.github.com/824546

VladimirMangos commented 13 years ago

Oh, thank you :) Fixed in [11160]