From 304af5185decaf5087be7471fe4bfae05584147b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kucha=C5=99?= Date: Thu, 31 Dec 2020 18:50:28 +0100 Subject: [PATCH] PostgreSQL driver: escaping of save point name (#383) --- src/Dibi/Drivers/PostgreDriver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Dibi/Drivers/PostgreDriver.php b/src/Dibi/Drivers/PostgreDriver.php index f3aff92c..f020876f 100644 --- a/src/Dibi/Drivers/PostgreDriver.php +++ b/src/Dibi/Drivers/PostgreDriver.php @@ -188,7 +188,7 @@ public function getInsertId(?string $sequence): ?int */ public function begin(string $savepoint = null): void { - $this->query($savepoint ? "SAVEPOINT $savepoint" : 'START TRANSACTION'); + $this->query($savepoint ? "SAVEPOINT {$this->escapeIdentifier($savepoint)}" : 'START TRANSACTION'); } @@ -198,7 +198,7 @@ public function begin(string $savepoint = null): void */ public function commit(string $savepoint = null): void { - $this->query($savepoint ? "RELEASE SAVEPOINT $savepoint" : 'COMMIT'); + $this->query($savepoint ? "RELEASE SAVEPOINT {$this->escapeIdentifier($savepoint)}" : 'COMMIT'); } @@ -208,7 +208,7 @@ public function commit(string $savepoint = null): void */ public function rollback(string $savepoint = null): void { - $this->query($savepoint ? "ROLLBACK TO SAVEPOINT $savepoint" : 'ROLLBACK'); + $this->query($savepoint ? "ROLLBACK TO SAVEPOINT {$this->escapeIdentifier($savepoint)}" : 'ROLLBACK'); }