From 7c42905d10f978ba08b8dc765f8f1d6b692d74d2 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sat, 8 Aug 2015 18:12:20 -0400 Subject: [PATCH] Fix issue with postgres. Postgres gets pretty picky about aliases in subqueries. --- tests/TestCase/ORM/QueryRegressionTest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/TestCase/ORM/QueryRegressionTest.php b/tests/TestCase/ORM/QueryRegressionTest.php index 99aebab8b79..95a8861ae17 100644 --- a/tests/TestCase/ORM/QueryRegressionTest.php +++ b/tests/TestCase/ORM/QueryRegressionTest.php @@ -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);