Browse Source

Fix issue with postgres.

Postgres gets pretty picky about aliases in subqueries.
Mark Story 10 years ago
parent
commit
7c42905d10
1 changed files with 8 additions and 4 deletions
  1. 8 4
      tests/TestCase/ORM/QueryRegressionTest.php

+ 8 - 4
tests/TestCase/ORM/QueryRegressionTest.php

@@ -1032,12 +1032,16 @@ class QueryRegressionTest extends TestCase
     {
         $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);