From: epotocko at gmail dot com Operating system: Windows XP PHP version: 5.2.0 PHP Bug Type: PostgreSQL related Bug description: pg_insert / pg_update do not allow now() to be used for timestamp fields
Description: ------------ The pg_insert and pg_update functions will not accept now() as a valid value for timestamp fields. Reproduce code: --------------- // Assumes the following table exists: /* CREATE TABLE timestamp_test ( id serial NOT NULL, mytime timestamp NOT NULL, CONSTRAINT timestamp_test_pkey PRIMARY KEY (id) ) WITHOUT OIDS; */ $dbConn = pg_connect(); $values = array('mytime' => 'now()'); pg_insert($dbConn, 'timestamp_test', $values); $ids = array('id' => 1); $fields = array('mytime' => 'now()'); pg_update($dbConn, 'timestamp_test', $fields, $ids); Expected result: ---------------- Both the insert and the update should succeed. Actual result: -------------- Error Log: PHP Notice: pg_insert() [<a href='function.pg-insert'>function.pg-insert</a>]: 'now()' does not match with '^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\.[0-9]+){0,1}([ \t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[a-zA-Z]{1,5})){0,1})){0,1}$' PHP Notice: pg_insert() [<a href='function.pg-insert'>function.pg-insert</a>]: Expects NULL or string for PostgreSQL timestamp field (mytime) PHP Notice: pg_update() [<a href='function.pg-update'>function.pg-update</a>]: 'now()' does not match with '^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\.[0-9]+){0,1}([ \t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[a-zA-Z]{1,5})){0,1})){0,1}$' PHP Notice: pg_update() [<a href='function.pg-update'>function.pg-update</a>]: Expects NULL or string for PostgreSQL timestamp field (mytime) -- Edit bug report at http://bugs.php.net/?id=39971&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39971&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39971&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39971&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39971&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39971&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39971&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39971&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39971&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39971&r=support Expected behavior: http://bugs.php.net/fix.php?id=39971&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39971&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39971&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39971&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39971&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39971&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39971&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39971&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39971&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39971&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39971&r=mysqlcfg