Page 1 of 1

Database error in serendipity_event_microformats plugin

Posted: Sat Nov 29, 2008 8:31 pm
by ads
Hello,

the plugin in $topic uses a MySQL specific SQL command:

Code: Select all

value > (UNIX_TIMESTAMP(NOW()) - 432000)
PostgreSQL (don't know about other databases) has no "unix_timestamp" function, one can use:

Code: Select all

value > (extract(epoch from now())::integer - 432000)

If i do a grep in the blog directory i see 4 other occurences of UNIX_TIMESTAMP.

Re: Database error in serendipity_event_microformats plugin

Posted: Mon Dec 01, 2008 10:16 am
by garvinhicking
Hi!

When "value" is a string field, how would the SQL statement need to look like for proper integer casting for pgsql?

Regards,
Garvin

Posted: Mon Dec 01, 2008 11:01 am
by ads

Code: Select all

value::integer
or

Code: Select all

cast(value as integer)

Posted: Mon Dec 01, 2008 1:08 pm
by garvinhicking
Hi!

Okay, thanks. I'll try to patch up the plugins that use this.


Regards,
Garvin

Posted: Mon Dec 01, 2008 1:11 pm
by ads
I only have PG 8.2 running which is not as strict as 8.3 with implicit casts. maybe someone else can test your patch on PG 8.3 too.