Skip to content

Commit 952b122

Browse files
committed
Check for type query failure
Turns out there are circumstances in which this query can fail, for instance, if PgBouncer is used.
1 parent 5e03b83 commit 952b122

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Internal/PgSqlHandle.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ private static function fetchTypes(\PgSql\Connection $handle): array
179179
FROM pg_catalog.pg_type t JOIN pg_catalog.pg_namespace n ON t.typnamespace=n.oid
180180
WHERE t.typisdefined AND n.nspname IN ('pg_catalog', 'public') ORDER BY t.oid");
181181

182+
if ($result === false) {
183+
throw new SqlException(\pg_last_error($handle));
184+
}
185+
182186
$types = [];
183187
while ($row = \pg_fetch_array($result, mode: \PGSQL_NUM)) {
184188
[$oid, $type, $delimiter, $element] = $row;

0 commit comments

Comments
 (0)