Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 002657f

Browse files
committed
Add LIMIT syntax for Jan.
1 parent ca2995b commit 002657f

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

src/backend/nodes/copyfuncs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.48 1998/09/01 04:29:00 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.49 1998/10/22 13:52:20 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1578,6 +1578,9 @@ _copyQuery(Query *from)
15781578
newnode->unionClause = temp_list;
15791579
}
15801580

1581+
Node_Copy(from, newnode, limitOffset);
1582+
Node_Copy(from, newnode, limitCount);
1583+
15811584
return newnode;
15821585
}
15831586

src/backend/nodes/outfuncs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.46 1998/09/01 04:29:07 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.47 1998/10/22 13:52:21 momjian Exp $
1111
*
1212
* NOTES
1313
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -259,6 +259,10 @@ _outQuery(StringInfo str, Query *node)
259259
appendStringInfo(str, (node->hasSubLinks ? "true" : "false"));
260260
appendStringInfo(str, " :unionClause ");
261261
_outNode(str, node->unionClause);
262+
appendStringInfo(str, " :limitOffset ");
263+
_outNode(str, node->limitOffset);
264+
appendStringInfo(str, " :limitCount ");
265+
_outNode(str, node->limitCount);
262266
}
263267

264268
static void

src/backend/nodes/readfuncs.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.37 1998/09/01 04:29:12 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.38 1998/10/22 13:52:22 momjian Exp $
1111
*
1212
* NOTES
1313
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -163,6 +163,12 @@ _readQuery()
163163
token = lsptok(NULL, &length); /* skip :unionClause */
164164
local_node->unionClause = nodeRead(true);
165165

166+
token = lsptok(NULL, &length); /* skip :limitOffset */
167+
local_node->limitOffset = nodeRead(true);
168+
169+
token = lsptok(NULL, &length); /* skip :limitCount */
170+
local_node->limitCount = nodeRead(true);
171+
166172
return local_node;
167173
}
168174

src/include/nodes/parsenodes.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: parsenodes.h,v 1.60 1998/10/02 16:23:07 momjian Exp $
9+
* $Id: parsenodes.h,v 1.61 1998/10/22 13:52:24 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -60,6 +60,8 @@ typedef struct Query
6060

6161
List *unionClause; /* unions are linked under the previous
6262
* query */
63+
Node *limitOffset; /* # of result tuples to skip */
64+
Node *limitCount; /* # of result tuples to return */
6365

6466
/* internal to planner */
6567
List *base_rel_list; /* base relation list */
@@ -639,6 +641,8 @@ typedef struct SelectStmt
639641
char *portalname; /* the portal (cursor) to create */
640642
bool binary; /* a binary (internal) portal? */
641643
bool unionall; /* union without unique sort */
644+
Node *limitOffset; /* # of result tuples to skip */
645+
Node *limitCount; /* # of result tuples to return */
642646
} SelectStmt;
643647

644648

0 commit comments

Comments
 (0)