Closed repli2dev closed 6 years ago
It is related to https://github.com/nette/database/commit/ef1a467eecd0b915dde52bf7c84cc03d36a4bd0f (fix for #202).
It seems that there is stupid limitation that you can bind parameters only to SELECT, INSERT, UPDATE, DELETE, or VALUES statements…
There is interesting discussion about the topic in Yii: https://github.com/yiisoft/yii2/issues/6410
From that I would conclude that the PostgreSQL prepared statements (used by PDO) doesn't work when using SET TIME ZONE $1
or when using the placeholder in table/column name position (SELECT * FROM $1)
... and the previous version of nette/database just got around it somehow.
There seem to be a kind of workaround:
$connection->getPdo()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
There is some documentation http://php.net/manual/en/pdo.setattribute.php, however the claim It will always fall back to emulating the prepared statement if the driver cannot successfully prepare the current query.
does seem to be in contrary with our findings.
Works... Thanks :-)
Version: 2.4.7
Bug Description
After update from 2.4.6 to 2.4.7 our application crashes on first database query:
With an following error:
Steps To Reproduce
Expected Behavior
Timezone is set.