php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33736 PDO confuses pgsql cast operator with named parameter
Submitted: 2005-07-17 20:04 UTC Modified: 2005-07-18 19:27 UTC
From: php at sagi dot org Assigned:
Status: Closed Package: PDO related
PHP Version: 5.1.0b2 OS: Linux
Private report: No CVE-ID: None
 [2005-07-17 20:04 UTC] php at sagi dot org
Description:
------------
I'm trying to execute a query similar to this:
INSERT INTO table (name, created_at) VALUES (:name, FROM_UNIXTIME(:created_at)::TIMESTAMP);

On postgres7.4. FROM_UNIXTIME is a custom function, I try to cast its value to TIMESTAMP using the '::' operator.

However, PDO thinks ':TIMESTAMP' is a name of another parameter, so it throws this exception: 'SQLSTATE[HY093]: Invalid parameter number: parameter was not defined'

Perhaps PDO should not treat '::' as a parameter or at least provide a way to escape ':'.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-18 16:47 UTC] wez@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-07-18 16:47 UTC] wez@php.net
Please try the snap dated *after* this message.
 [2005-07-18 19:27 UTC] php at sagi dot org
Seems fine after some basic testing, thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 10:01:29 2024 UTC