Piwigo Bugtracker

Viewing Issue Advanced Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001739 [Piwigo] photos minor always 2010.06.23 00:14 2010.06.30 00:03
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.2 Product Version 2.1.1
  Target Version Product Build Trunk r6585
Summary 0001739: [PostgreSQL] Recent pictures page returns database error
Description Because there are no images in the database, the recent pictures page fails. The query in admin/element_set.php on line 196 return a single row with no value, because there are no images in the database.

I suggest the following rewrite:

  $query = 'SELECT MAX(date_available) AS date
  FROM '.IMAGES_TABLE;
  if ($row = pwg_db_fetch_assoc( pwg_query($query) ) )
  {
    if (isset($row['date']))
    {
      $query = 'SELECT id
  FROM '.IMAGES_TABLE.'
  WHERE date_available BETWEEN '.pwg_db_get_recent_period_expression(1, $row['date']).' AND \''.$row['date'].'\'';
      $page['cat_elements_id'] = array_from_query($query, 'id');
    }
  }
Steps To Reproduce New installation -> Administration -> Photos -> Recent pictures
Additional Information Warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid input syntax for type date: "" LINE 3: WHERE date_available BETWEEN (''::date - '1 DAY'::interval... ^ in /var/www/sites/fotos.aarjan.nl/piwigo/piwigo_svn/include/dblayer/functions_pgsql.inc.php on line 122
SELECT id FROM piwigo_images WHERE date_available BETWEEN (''::date - '1 DAY'::interval)::date AND ''
ERROR: invalid input syntax for type date: "" LINE 3: WHERE date_available BETWEEN (''::date - '1 DAY'::interval... ^
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
(0004002)
svn (reporter)
2010.06.24 20:48

[Subversion] r6599 by nikrou on trunk

-----[Subversion commit log]----------------------------------------------------
Bug 1739 fixed : Recent pictures page returns database error
If there's no image in database, don't select thems !
(0004003)
svn (reporter)
2010.06.24 20:49

[Subversion] r6600 by nikrou on branch 2.1

-----[Subversion commit log]----------------------------------------------------
Bug 1739 fixed : Recent pictures page returns database error
merge from trunk

- Issue History
Date Modified Username Field Change
2010.06.23 00:14 madman New Issue
2010.06.23 00:14 madman browser => Mozilla
2010.06.23 00:14 madman Database engine and version => Postgresql 8.4.2
2010.06.23 00:14 madman PHP version => 5.3.2
2010.06.23 00:14 madman Web server => Apache 2.2.3
2010.06.23 20:18 nikrou Status new => assigned
2010.06.23 20:18 nikrou Assigned To => nikrou
2010.06.24 20:48 svn Checkin
2010.06.24 20:48 svn Note Added: 0004002
2010.06.24 20:49 svn Checkin
2010.06.24 20:49 svn Note Added: 0004003
2010.06.24 20:50 nikrou Status assigned => closed
2010.06.24 20:50 nikrou Resolution open => fixed
2010.06.24 20:50 nikrou Fixed in Version => 2.1.2
2010.06.30 00:03 plg Summary Recent pictures page returns database error => [PostgreSQL] Recent pictures page returns database error


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