]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix oversights in processing of LIMIT expressions during planning.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 11 May 2004 13:15:23 +0000 (13:15 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 11 May 2004 13:15:23 +0000 (13:15 +0000)
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/subselect.c

index ec21c1a8d3be5819b2a93d7fdde0d3c60071b843..495eaa9730060d71607533f82bf2c7eedb35c136 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.97 2003/08/08 21:41:50 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.97.4.1 2004/05/11 13:15:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -189,7 +189,6 @@ set_plan_references(Plan *plan, List *rtable)
                case T_Sort:
                case T_Unique:
                case T_SetOp:
-               case T_Limit:
 
                        /*
                         * These plan types don't actually bother to evaluate their
@@ -202,6 +201,15 @@ set_plan_references(Plan *plan, List *rtable)
                         * the plan tree!
                         */
                        break;
+               case T_Limit:
+                       /*
+                        * Like the plan types above, Limit doesn't evaluate its
+                        * tlist or quals.  It does have live expressions for
+                        * limit/offset, however.
+                        */
+                       fix_expr_references(plan, ((Limit *) plan)->limitOffset);
+                       fix_expr_references(plan, ((Limit *) plan)->limitCount);
+                       break;
                case T_Agg:
                case T_Group:
                        set_uppernode_references(plan, (Index) 0);
index 5da291835ade72e26f279ac6947e56255190ca85..be53ba80be70fd588e23b1df84cc7bbcb94aae3e 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.83.2.1 2003/11/25 23:59:32 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.83.2.2 2004/05/11 13:15:23 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1018,6 +1018,13 @@ finalize_plan(Plan *plan, List *rtable,
                                                          &context);
                        break;
 
+               case T_Limit:
+                       finalize_primnode(((Limit *) plan)->limitOffset,
+                                                         &context);
+                       finalize_primnode(((Limit *) plan)->limitCount,
+                                                         &context);
+                       break;
+
                case T_Hash:
                        finalize_primnode((Node *) ((Hash *) plan)->hashkeys,
                                                          &context);
@@ -1029,7 +1036,6 @@ finalize_plan(Plan *plan, List *rtable,
                case T_Sort:
                case T_Unique:
                case T_SetOp:
-               case T_Limit:
                case T_Group:
                        break;