|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68572 [PHP Modules] apc bcmath bz2 calendar Core ctype curl date dba dom ereg exif fi
Submitted: 2014-12-09 06:50 UTC Modified: 2015-02-03 10:21 UTC
From: me at free6k dot ru Assigned:
Status: Not a bug Package: PDO PgSQL
PHP Version: 5.4.35 OS: Debian 7.7 Wheezy
Private report: No CVE-ID: None
 [2014-12-09 06:50 UTC] me at free6k dot ru
I have the following problem with binding params in pdo for sql requests

Test script:
$timezone = 'Asia/Jakarta';
$statement = $pdo->prepare('SET TIME ZONE :timezone');

Actual result:
SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "$1"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-03 10:21 UTC]
-Status: Open +Status: Not a bug
 [2015-02-03 10:21 UTC]
Thank you for taking the time to write to us, but this is not
a bug. 

Postgres doesn't support preparing a SET TIME ZONE query:

(And PDO_pgsql will try to prepare it, since you are using a parameter)

You could either generate the query manually (using PDO::quote) or temporarily using: $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 10:02:33 2024 UTC