1
0
mirror of synced 2024-12-14 07:06:04 +03:00

Fixed postgresql hidden scalar sort

This commit is contained in:
denkiryokuhatsuden 2013-04-03 17:22:31 +09:00
parent e54c11e3bb
commit 7af84e79e5

View File

@ -91,8 +91,26 @@ class LimitSubqueryOutputWalker extends SqlWalker
*/
public function walkSelectStatement(SelectStatement $AST)
{
if ($this->platform instanceof PostgreSqlPlatform) {
// Set every select expression as visible(hidden = false) to
// make $AST to have scalar mappings properly
$hiddens = array();
foreach ($AST->selectClause->selectExpressions as $idx => $expr) {
$hiddens[$idx] = $expr->hiddenAliasResultVariable;
$expr->hiddenAliasResultVariable = false;
}
$innerSql = parent::walkSelectStatement($AST);
// Restore hiddens
foreach ($AST->selectClause->selectExpressions as $idx => $expr) {
$expr->hiddenAliasResultVariable = $hiddens[$idx];
}
} else {
$innerSql = parent::walkSelectStatement($AST);
}
// Find out the SQL alias of the identifier column of the root entity.
// It may be possible to make this work with multiple root entities but that
// would probably require issuing multiple queries or doing a UNION SELECT.