Piwigo Bugtracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001739Piwigophotospublic2010.06.23 00:142010.06.30 00:03
Reportermadman 
Assigned Tonikrou 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformPostgresqlOSCentOS 5.4OS VersionPostgresql 8.4.2
Product Version2.1.1 
Target VersionFixed in Version2.1.2 
Summary0001739: [PostgreSQL] Recent pictures page returns database error
DescriptionBecause 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 ReproduceNew installation -> Administration -> Photos -> Recent pictures
Additional InformationWarning: 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... ^
TagsNo tags attached.
browserMozilla
Database engine and versionPostgresql 8.4.2
PHP version5.3.2
Web serverApache 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


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