MantisBT - Piwigo
View Issue Details
0001766Piwigodatabasepublic2010.07.05 23:572010.07.06 14:17
madman 
nikrou 
normalminorsometimes
closedfixed 
PostgresqlCentOS 5.4Postgresql 8.4.2
2.1.2 
2.1.3 
Mozilla
Postgresql 8.4.2
5.3.2
Apache 2.2.3
0001766: [PostgreSQL] unkown database function UNIX_TIMESTAMP()
A database function UNIX_TIMESTAMP is used, but this function isn't created in the PostgreSQL database. It is used in include/functions_session.inc.php on line 178. The following code can be used to create a database function unix_timestamp()

create language plpgsql;

create or replace function UNIX_TIMESTAMP(in_timestamp timestamp with time zone) returns integer as $$
begin
    return floor(extract(epoch FROM in_timestamp));
end;
$$ LANGUAGE plpgsql;

Warning: pg_query() [function.pg-query]: Query failed: ERROR: function unix_timestamp(timestamp with time zone) does not exist LINE 4: WHERE UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(expiration) >... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. in /var/www/sites/fotos.aarjan.nl/piwigo/piwigo_svn/include/dblayer/functions_pgsql.inc.php on line 122
DELETE FROM piwigo_sessions WHERE UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(expiration) > 3600 ;
ERROR: function unix_timestamp(timestamp with time zone) does not exist LINE 4: WHERE UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(expiration) >... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.
No tags attached.
Issue History
2010.07.05 23:57madmanNew Issue
2010.07.05 23:57madmanbrowser => Mozilla
2010.07.05 23:57madmanDatabase engine and version => Postgresql 8.4.2
2010.07.05 23:57madmanPHP version => 5.3.2
2010.07.05 23:57madmanWeb server => Apache 2.2.3
2010.07.06 14:12nikrouNote Added: 0004032
2010.07.06 14:12nikrouStatusnew => assigned
2010.07.06 14:12nikrouAssigned To => nikrou
2010.07.06 14:14svnCheckin
2010.07.06 14:14svnNote Added: 0004033
2010.07.06 14:17svnCheckin
2010.07.06 14:17svnNote Added: 0004034
2010.07.06 14:17nikrouStatusassigned => closed
2010.07.06 14:17nikrouResolutionopen => fixed
2010.07.06 14:17nikrouFixed in Version => 2.1.3

Notes
(0004032)
nikrou   
2010.07.06 14:12   
I'm not sure that introduce a pl function is a good idea but tell me if you think it's a good idea.
I prefer to introduce a new php function to calculate timestamp from a date.
(0004033)
svn   
2010.07.06 14:14   
[Subversion] r6666 by nikrou on trunk

-----[Subversion commit log]----------------------------------------------------
Bug 1766 fixed : [PostgreSQL] unkown database function UNIX_TIMESTAMP()
Add a new function pwg_db_date_to_ts() to calculate a timestamp from a date
(0004034)
svn   
2010.07.06 14:17   
[Subversion] r6667 by nikrou on branch 2.1

-----[Subversion commit log]----------------------------------------------------
Bug 1766 fixed : [PostgreSQL] unkown database function UNIX_TIMESTAMP()
Add a new function pwg_db_date_to_ts() to calculate a timestamp from a date
Merge from trunk