|  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
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.
Block user comment
Status: Assign to:
Bug Type:
From: me at free6k dot ru
New email:
PHP Version: OS:


 [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-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 09 18:01:28 2023 UTC