From 002657f7ed0ff365cfd5079f955badd2a30441f6 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 22 Oct 1998 13:52:24 +0000 Subject: [PATCH] Add LIMIT syntax for Jan. --- src/backend/nodes/copyfuncs.c | 5 ++++- src/backend/nodes/outfuncs.c | 6 +++++- src/backend/nodes/readfuncs.c | 8 +++++++- src/include/nodes/parsenodes.h | 6 +++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 5083b47dbf..6213456b0d 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -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; } diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index f018fc5892..f78eb73a15 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -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 diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index 9ffbc29043..e56f92f483 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -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; } diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 0608c3101f..afe6fe43f7 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -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; -- 2.11.0