Piwigo Bugtracker

Viewing Issue Advanced Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001766 [Piwigo] database minor sometimes 2010.07.05 23:57 2010.07.06 14:17
Reporter madman View Status public  
Assigned To nikrou
Priority normal Resolution fixed Platform Postgresql
Status closed   OS CentOS 5.4
Projection none   OS Version Postgresql 8.4.2
ETA none Fixed in Version 2.1.3 Product Version 2.1.2
  Target Version Product Build Trunk r6661
Summary 0001766: [PostgreSQL] unkown database function UNIX_TIMESTAMP()
Description 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;
Steps To Reproduce
Additional Information
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.
Tags No tags attached.
browser Mozilla
Database engine and version Postgresql 8.4.2
PHP version 5.3.2
Web server Apache 2.2.3
Attached Files

- Relationships

-  Notes
(0004032)
nikrou (developer)
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 (reporter)
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 (reporter)
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

- Issue History
Date Modified Username Field Change
2010.07.05 23:57 madman New Issue
2010.07.05 23:57 madman browser => Mozilla
2010.07.05 23:57 madman Database engine and version => Postgresql 8.4.2
2010.07.05 23:57 madman PHP version => 5.3.2
2010.07.05 23:57 madman Web server => Apache 2.2.3
2010.07.06 14:12 nikrou Note Added: 0004032
2010.07.06 14:12 nikrou Status new => assigned
2010.07.06 14:12 nikrou Assigned To => nikrou
2010.07.06 14:14 svn Checkin
2010.07.06 14:14 svn Note Added: 0004033
2010.07.06 14:17 svn Checkin
2010.07.06 14:17 svn Note Added: 0004034
2010.07.06 14:17 nikrou Status assigned => closed
2010.07.06 14:17 nikrou Resolution open => fixed
2010.07.06 14:17 nikrou Fixed in Version => 2.1.3


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Contact
Powered by Mantis Bugtracker