I have a site that uses PostgreSQL. When setting up a date-pager (a component of the date_view module), suddenly my site gets these errors:

PDOException: SQLSTATE[22023]: Invalid parameter value: 7 ERROR: time zone "US/Central" not recognized: SELECT '2008-02-15 12:00:00 UTC' AT TIME ZONE 'US/Central'; Array ( ) in date_sql_handler->db_tz_support() (line 112 of /home/myuser/public_html/sites/all/modules/contrib/date/date_api/date_api_sql.inc).

This site was imported as-is from another installation, on a server where they had already configured Postgres, and this error did NOT occur there, when I set up the date pager following the exact same procedure (create a date contextual filter, then enable paging by date). My new (shared) host is in the "US/Central" timezone, so I suspect this is due to something to do with their Postgres config.

The error is happening at a place in the code where it is doing this: "See if the db has timezone name support." Clearly, in my case, the db does NOT have timezone name support, but this fact is getting clobbered by an exception.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dan3h’s picture

Status: Active » Needs review
FileSize
819 bytes

Fix attached -- simply adds exception-handling to the test.

Status: Needs review » Needs work

The last submitted patch, 1: date-pdoexception-2453445-1.patch, failed testing.

rahul.nahar001’s picture

Status: Needs work » Needs review
FileSize
833 bytes

Please find updated patch file.

DamienMcKenna’s picture

Title: PDOException not handled in test » PDOException not handled when using PostgreSQL without timezone support
Version: 7.x-2.8 » 7.x-2.x-dev
Issue tags: +PostgreSQL
DamienMcKenna’s picture

Rerolled, and I tied up the comments a little.

DamienMcKenna’s picture

Status: Needs review » Fixed

Committed. Thank you!

  • DamienMcKenna committed 7a42ab8 on 7.x-2.x authored by dan3h
    Issue #2453445 by DamienMcKenna, dan3h, rahul.nahar001: PDOException not...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.