diff --git a/src/Phinx/Db/Adapter/PostgresAdapter.php b/src/Phinx/Db/Adapter/PostgresAdapter.php index da79eb030..843cb8306 100644 --- a/src/Phinx/Db/Adapter/PostgresAdapter.php +++ b/src/Phinx/Db/Adapter/PostgresAdapter.php @@ -60,6 +60,17 @@ class PostgresAdapter extends PdoAdapter */ protected bool $useIdentity; + /** + * {@inheritDoc} + */ + public function setConnection(PDO $connection): AdapterInterface + { + // always set here since connect() isn't always called + $this->useIdentity = (float)$connection->getAttribute(PDO::ATTR_SERVER_VERSION) >= 10; + + return parent::setConnection($connection); + } + /** * {@inheritDoc} * @@ -115,8 +126,6 @@ public function connect(): void ); } - $this->useIdentity = (float)$db->getAttribute(PDO::ATTR_SERVER_VERSION) >= 10; - $this->setConnection($db); } }