Piwigo Bugtracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001736Piwigonotificationpublic2010.06.21 23:302010.06.30 00:19
Reportermadman 
Assigned Tonikrou 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformPostgresqlOSCentOS 5.4OS VersionPostgresql 8.4.2
Product Version2.1.1 
Target VersionFixed in Version2.1.2 
Summary0001736: [PostgreSQL] Complete RSS Feed returns error
DescriptionThe function custom_notification_query() is not able to handle null values properly. See the error for more detail; the parameter $start is empty. In PostgreSQL database an empty string is not a valid timestamp.

The best way to fix this problem is to remove the WHERE-clause if $start is empty. Note that this should also be fixed for the $end parameter since the nb_waiting_elements() has both parameters empty.

The function could be rewrite like this (note this is only the top part):
function custom_notification_query($action, $type, $start, $end)
{
  global $user;

  switch($type)
  {
    case 'new_comments':
      $query = '
  FROM '.COMMENTS_TABLE.' AS c
     , '.IMAGE_CATEGORY_TABLE.' AS ic
  WHERE c.image_id = ic.image_id ';
      $query .= (!empty($start)) ? ' AND c.validation_date > \''.$start.'\'' : '';
      $query .= (!empty($end)) ? ' AND c.validation_date <= \''.$end.'\'' : '';
      $query .= get_std_sql_where_restrict_filter('AND').'
;';
      break;
    case 'unvalidated_comments':
      $query = '
  FROM '.COMMENTS_TABLE.'
  WHERE validated = \'false\' ';
      $query .= (!empty($start)) ? ' AND date > \''.$start.'\'' : '';
      $query .= (!empty($end)) ? ' AND date <= \''.$end.'\'' : '';
      $query .= '
;';
Additional InformationWarning: pg_query() [function.pg-query]: Query failed: ERROR: invalid input syntax for type timestamp: "" LINE 6: AND c.validation_date > '' ^ in /var/www/sites/fotos.aarjan.nl/piwigo/piwigo_svn/include/dblayer/functions_pgsql.inc.php on line 122
SELECT count(distinct c.id) as CountId FROM piwigo_comments AS c , piwigo_image_category AS ic WHERE c.image_id = ic.image_id AND c.validation_date > '' AND c.validation_date <= '2010-06-21 23:06:57.848997+02' ;
ERROR: invalid input syntax for type timestamp: "" LINE 6: AND c.validation_date > '' ^
TagsNo tags attached.
browserMozilla
Database engine and versionPostgresql 8.4.2
PHP version5.3.2
Web serverApache 2.2.3
Attached Files

- Relationships

-  Notes
(0003985)
madman (reporter)
2010.06.21 23:33

Is is for MySQL really necessary to end each query with a semicolon? I can leave them out in my PHP code that I write for PostgreSQL and Oracle databases.
(0003986)
nikrou (developer)
2010.06.22 22:23

> Is is for MySQL really necessary to end each query with a semicolon? I can leave them out in my PHP code that I write for PostgreSQL and Oracle databases.

I don't think so. We used to add a semicolon for each query in case we make two queries in the same mysql_query() function. I think we can remove it, but I prefered to double check.
(0004000)
svn (reporter)
2010.06.24 20:42

[Subversion] r6597 by nikrou on trunk

-----[Subversion commit log]----------------------------------------------------
Bug 1736 fixed : Complete RSS Feed returns error
start or end dates can be null
(0004001)
svn (reporter)
2010.06.24 20:44

[Subversion] r6598 by nikrou on branch 2.1

-----[Subversion commit log]----------------------------------------------------
Bug 1736 fixed : Complete RSS Feed returns error start or end dates can be null
merge from trunk

- Issue History
Date Modified Username Field Change
2010.06.21 23:30 madman New Issue
2010.06.21 23:30 madman browser => Mozilla
2010.06.21 23:30 madman MySQL version => Postgresql 8.4.2
2010.06.21 23:30 madman PHP version => 5.3.2
2010.06.21 23:30 madman Web server => Apache 2.2.3
2010.06.21 23:33 madman Note Added: 0003985
2010.06.22 09:20 plg Status new => assigned
2010.06.22 09:20 plg Assigned To => nikrou
2010.06.22 22:23 nikrou Note Added: 0003986
2010.06.24 20:42 svn Checkin
2010.06.24 20:42 svn Note Added: 0004000
2010.06.24 20:44 svn Checkin
2010.06.24 20:44 svn Note Added: 0004001
2010.06.24 20:45 nikrou Status assigned => closed
2010.06.24 20:45 nikrou Resolution open => fixed
2010.06.24 20:45 nikrou Fixed in Version => 2.1.2
2010.06.30 00:03 plg Summary Compleet RSS Feed returns error => [PostgreSQL] Compleet RSS Feed returns error
2010.06.30 00:03 plg Additional Information Updated
2010.06.30 00:19 plg Summary [PostgreSQL] Compleet RSS Feed returns error => [PostgreSQL] Complete RSS Feed returns error


Copyright © 2000 - 2015 MantisBT Team
Contact
Powered by Mantis Bugtracker