Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Codeception/Lib/Driver/PostgreSql.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function getPrimaryKey(string $tableName): array
FROM pg_index i
JOIN pg_attribute a ON a.attrelid = i.indrelid
AND a.attnum = ANY(i.indkey)
WHERE i.indrelid = '{$tableName}'::regclass
WHERE i.indrelid = '\"{$tableName}\"'::regclass
AND i.indisprimary";
$stmt = $this->executeQuery($query, []);
$columns = $stmt->fetchAll(PDO::FETCH_ASSOC);
Expand Down
4 changes: 4 additions & 0 deletions tests/data/dumps/postgres.sql
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ CREATE TABLE "no_pk" (
"status" VARCHAR NOT NULL
);

CREATE TABLE "NoPk" (
"Status" VARCHAR NOT NULL
);

CREATE TABLE "order" (
"id" INTEGER NOT NULL PRIMARY KEY,
"name" VARCHAR NOT NULL,
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/Codeception/Module/Db/PostgreSqlDbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ public function getConfig(): array
'populate' => true
];
}

public function testHaveInDatabaseWithUppercaseTableName()
{
$testData = ['Status' => 'test'];
$this->module->haveInDatabase('NoPk', $testData);
}
}