Skip to content

Commit b181bf1

Browse files
committed
Update PdoPgSqlQueryReflector.php
1 parent 9e97527 commit b181bf1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/QueryReflection/PdoPgSqlQueryReflector.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected function checkInformationSchema(string $tableName): Iterator
109109
if (null === $this->stmt) {
110110
$this->stmt = $this->pdo->prepare(
111111
<<<'PSQL'
112-
SELECT column_name, column_default, is_nullable
112+
SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE
113113
FROM information_schema.columns
114114
WHERE table_name = ?
115115
PSQL
@@ -119,12 +119,10 @@ protected function checkInformationSchema(string $tableName): Iterator
119119
$this->stmt->execute([$tableName]);
120120
$result = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
121121

122-
// pgsql and mysql have a similar named but different information schema, with different cased key-words
123-
/** @var array{column_default?: string, column_name: string, is_nullable: string} $row */ // @phpstan-ignore varTag.type
124122
foreach ($result as $row) {
125-
$default = $row['column_default'] ?? '';
126-
$columnName = $row['column_name'];
127-
$isNullable = 'YES' === $row['is_nullable'];
123+
$default = $row['COLUMN_DEFAULT'] ?? '';
124+
$columnName = $row['COLUMN_NAME'];
125+
$isNullable = 'YES' === $row['IS_NULLABLE'];
128126

129127
if (! $isNullable) {
130128
yield $columnName => PgsqlTypeMapper::FLAG_NOT_NULL;

0 commit comments

Comments
 (0)