Skip to content

Commit

Permalink
Fix issue with postgres.
Browse files Browse the repository at this point in the history
Postgres gets pretty picky about aliases in subqueries.
  • Loading branch information
markstory committed Aug 8, 2015
1 parent 80908ec commit 7c42905
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/TestCase/ORM/QueryRegressionTest.php
Expand Up @@ -1032,12 +1032,16 @@ public function testComplexOrderWithUnion()
{
$table = TableRegistry::get('Comments');
$query = $table->find();
$inner = $table->find()->where(['id >' => 3]);
$inner2 = $table->find()->where(['id <' => 3]);
$inner = $table->find()
->select(['content' => 'comment'])
->where(['id >' => 3]);
$inner2 = $table->find()
->select(['content' => 'comment'])
->where(['id <' => 3]);

$order = $query->func()->concat(['inside__comment' => 'literal', 'test']);
$order = $query->func()->concat(['content' => 'literal', 'test']);

$query->select(['inside__comment' => 'Comments__comment'])
$query->select(['inside.content'])
->from(['inside' => $inner->unionAll($inner2)])
->orderAsc($order);

Expand Down

0 comments on commit 7c42905

Please sign in to comment.