summaryrefslogtreecommitdiff
path: root/src/include/nodes/execnodes.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-10-26 21:38:24 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-10-26 21:38:24 +0000
commit2f35b4efdbec6c161ca9bd491d6345134910c425 (patch)
tree2424351bcc12a8ddf2b716b28f53d2c37c79e507 /src/include/nodes/execnodes.h
parentc9476bafdb1b97d0d21d92788f93298962145479 (diff)
Re-implement LIMIT/OFFSET as a plan node type, instead of a hack in
ExecutorRun. This allows LIMIT to work in a view. Also, LIMIT in a cursor declaration will behave in a reasonable fashion, whereas before it was overridden by the FETCH count.
Diffstat (limited to 'src/include/nodes/execnodes.h')
-rw-r--r--src/include/nodes/execnodes.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 06de4be54cb..14cd94baa07 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: execnodes.h,v 1.51 2000/10/05 19:11:36 tgl Exp $
+ * $Id: execnodes.h,v 1.52 2000/10/26 21:38:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -675,6 +675,28 @@ typedef struct SetOpState
MemoryContext tempContext; /* short-term context for comparisons */
} SetOpState;
+/* ----------------
+ * LimitState information
+ *
+ * Limit nodes are used to enforce LIMIT/OFFSET clauses.
+ * They just select the desired subrange of their subplan's output.
+ *
+ * offset is the number of initial tuples to skip (0 does nothing).
+ * count is the number of tuples to return after skipping the offset tuples.
+ * If no limit count was specified, count is undefined and noCount is true.
+ * ----------------
+ */
+typedef struct LimitState
+{
+ CommonState cstate; /* its first field is NodeTag */
+ long offset; /* current OFFSET value */
+ long count; /* current COUNT, if any */
+ long position; /* 1-based index of last tuple fetched */
+ bool parmsSet; /* have we calculated offset/limit yet? */
+ bool noCount; /* if true, ignore count */
+ bool atEnd; /* if true, we've reached EOF of subplan */
+} LimitState;
+
/* ----------------
* HashState information