Skip to content

Commit 8f29241

Browse files
committed
Back-patch LIMIT + INTERSECT fix into 6.5.*.
1 parent a9ba771 commit 8f29241

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/backend/parser/gram.y

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.88.2.3 1999/09/24 15:08:59 thomas Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.88.2.4 1999/10/19 04:38:07 tgl Exp $
1414
*
1515
* HISTORY
1616
* AUTHOR DATE MAJOR EVENT
@@ -2768,6 +2768,8 @@ SelectStmt: select_clause sort_clause for_update_clause opt_select_limit
27682768
/* finally attach the sort clause */
27692769
first_select->sortClause = $2;
27702770
first_select->forUpdate = $3;
2771+
first_select->limitOffset = nth(0, $4);
2772+
first_select->limitCount = nth(1, $4);
27712773
$$ = (Node *)first_select;
27722774
}
27732775
if (((SelectStmt *)$$)->forUpdate != NULL && QueryIsRule)

src/backend/rewrite/rewriteHandler.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.48 1999/07/11 17:54:30 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.48.2.1 1999/10/19 04:38:05 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -2859,6 +2859,8 @@ Except_Intersect_Rewrite(Query *parsetree)
28592859
bool isBinary,
28602860
isPortal,
28612861
isTemp;
2862+
Node *limitOffset,
2863+
*limitCount;
28622864
CmdType commandType = CMD_SELECT;
28632865
List *rtable_insert = NIL;
28642866

@@ -2909,6 +2911,8 @@ Except_Intersect_Rewrite(Query *parsetree)
29092911
isBinary = parsetree->isBinary;
29102912
isPortal = parsetree->isPortal;
29112913
isTemp = parsetree->isTemp;
2914+
limitOffset = parsetree->limitOffset;
2915+
limitCount = parsetree->limitCount;
29122916

29132917
/*
29142918
* The operator tree attached to parsetree->intersectClause is still
@@ -3094,6 +3098,8 @@ Except_Intersect_Rewrite(Query *parsetree)
30943098
result->isPortal = isPortal;
30953099
result->isBinary = isBinary;
30963100
result->isTemp = isTemp;
3101+
result->limitOffset = limitOffset;
3102+
result->limitCount = limitCount;
30973103

30983104
/*
30993105
* The relation to insert into is attached to the range table of the

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy