Database error in serendipity_event_microformats plugin

Found a bug? Tell us!!
Post Reply
ads
Regular
Posts: 89
Joined: Sun Oct 29, 2006 12:39 pm

Database error in serendipity_event_microformats plugin

Post by ads » Sat Nov 29, 2008 9:31 pm

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.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Database error in serendipity_event_microformats plugin

Post by garvinhicking » Mon Dec 01, 2008 11:16 am

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: 89
Joined: Sun Oct 29, 2006 12:39 pm

Post by ads » Mon Dec 01, 2008 12:01 pm

Code: Select all

value::integer

or

Code: Select all

cast(value as integer)

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Mon Dec 01, 2008 2:08 pm

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: 89
Joined: Sun Oct 29, 2006 12:39 pm

Post by ads » Mon Dec 01, 2008 2:11 pm

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