summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/planmain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/plan/planmain.c')
-rw-r--r--src/backend/optimizer/plan/planmain.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c
index c31f7d5aa65..f8ff3a71508 100644
--- a/src/backend/optimizer/plan/planmain.c
+++ b/src/backend/optimizer/plan/planmain.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/planmain.c,v 1.101 2007/05/04 01:13:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/planmain.c,v 1.102 2007/07/07 20:46:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -106,9 +106,21 @@ query_planner(PlannerInfo *root, List *tlist,
*/
if (parse->jointree->fromlist == NIL)
{
+ /* We need a trivial path result */
*cheapest_path = (Path *)
create_result_path((List *) parse->jointree->quals);
*sorted_path = NULL;
+ /*
+ * We still are required to canonicalize any pathkeys, in case
+ * it's something like "SELECT 2+2 ORDER BY 1".
+ */
+ root->canon_pathkeys = NIL;
+ root->query_pathkeys = canonicalize_pathkeys(root,
+ root->query_pathkeys);
+ root->group_pathkeys = canonicalize_pathkeys(root,
+ root->group_pathkeys);
+ root->sort_pathkeys = canonicalize_pathkeys(root,
+ root->sort_pathkeys);
return;
}