diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index 8d2edc94296c..70f3ff461689 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -461,9 +461,10 @@ protected function _enableForeignKeyChecks() */ public function error(): array { + $lastError = pg_last_error($this->connID); return [ 'code' => '', - 'message' => ! in_array(pg_last_error($this->connID), ['', '0'], true) ? pg_last_error($this->connID) : '', + 'message' => ! in_array($lastError, ['', '0'], true) ? $lastError : '', ]; }