Database error in serendipity_event_microformats plugin

Found a bug? Tell us!!
Post Reply
ads
Regular
Posts: 93
Joined: Sun Oct 29, 2006 11:39 am

Database error in serendipity_event_microformats plugin

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Database error in serendipity_event_microformats plugin

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ads
Regular
Posts: 93
Joined: Sun Oct 29, 2006 11:39 am

Post by ads »

Code: Select all

value::integer
or

Code: Select all

cast(value as integer)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

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


Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ads
Regular
Posts: 93
Joined: Sun Oct 29, 2006 11:39 am

Post 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.
Post Reply