Add LIMIT syntax for Jan.

This commit is contained in:
Bruce Momjian 1998-10-22 13:52:24 +00:00
parent ca2995be7b
commit 002657f7ed
4 changed files with 21 additions and 4 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.48 1998/09/01 04:29:00 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.49 1998/10/22 13:52:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -1578,6 +1578,9 @@ _copyQuery(Query *from)
newnode->unionClause = temp_list;
}
Node_Copy(from, newnode, limitOffset);
Node_Copy(from, newnode, limitCount);
return newnode;
}

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.46 1998/09/01 04:29:07 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.47 1998/10/22 13:52:21 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@ -259,6 +259,10 @@ _outQuery(StringInfo str, Query *node)
appendStringInfo(str, (node->hasSubLinks ? "true" : "false"));
appendStringInfo(str, " :unionClause ");
_outNode(str, node->unionClause);
appendStringInfo(str, " :limitOffset ");
_outNode(str, node->limitOffset);
appendStringInfo(str, " :limitCount ");
_outNode(str, node->limitCount);
}
static void

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.37 1998/09/01 04:29:12 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.38 1998/10/22 13:52:22 momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@ -163,6 +163,12 @@ _readQuery()
token = lsptok(NULL, &length); /* skip :unionClause */
local_node->unionClause = nodeRead(true);
token = lsptok(NULL, &length); /* skip :limitOffset */
local_node->limitOffset = nodeRead(true);
token = lsptok(NULL, &length); /* skip :limitCount */
local_node->limitCount = nodeRead(true);
return local_node;
}

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: parsenodes.h,v 1.60 1998/10/02 16:23:07 momjian Exp $
* $Id: parsenodes.h,v 1.61 1998/10/22 13:52:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -60,6 +60,8 @@ typedef struct Query
List *unionClause; /* unions are linked under the previous
* query */
Node *limitOffset; /* # of result tuples to skip */
Node *limitCount; /* # of result tuples to return */
/* internal to planner */
List *base_rel_list; /* base relation list */
@ -639,6 +641,8 @@ typedef struct SelectStmt
char *portalname; /* the portal (cursor) to create */
bool binary; /* a binary (internal) portal? */
bool unionall; /* union without unique sort */
Node *limitOffset; /* # of result tuples to skip */
Node *limitCount; /* # of result tuples to return */
} SelectStmt;