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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at sagi dot org
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 19 15:03:37 2021 UTC