|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
23 + 43 = ?
Subscribe to this entry?

 [2005-07-17 20:04 UTC] php at sagi dot org
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 ':'.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-18 16:47 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-07-18 16:47 UTC]
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-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 08 17:03:54 2023 UTC