Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Support PostgreSQL and add PosgreSQL/SQLite for CI testing #7

Merged
merged 17 commits into from
Jan 5, 2020

Conversation

chitoku-k
Copy link
Member

In PostgreSQL, when a statement has an alias for a table, expressions in SELECT clause must refer to the field in FROM clause in exactly the same way as the alias including its quotation.

-- Valid
SELECT Post.id FROM posts AS Post;
SELECT "Post".id FROM posts AS "Post";

-- Invalid because the alias is quoted but the field is unquoted
SELECT Post.id FROM posts AS "Post";

As CakePHP automatically quotes the fields in SELECT clause, lampager-cakephp2 has to quote them as well before passing them to buildStatement().

@@ -112,7 +119,7 @@ protected function compileSelect(Select $select)
'alias' => $model->alias,
'table' => $db->fullTableName($model),
'fields' => [
"{$model->alias}.{$model->primaryKey}",
$db->name("{$model->alias}.{$model->primaryKey}"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

@chitoku-k chitoku-k merged commit 147299d into master Jan 5, 2020
@chitoku-k chitoku-k deleted the ci/db-engines branch January 5, 2020 04:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants