mirror of
https://github.com/postgres/postgres.git
synced 2025-07-23 03:21:12 +03:00
Allow ORDER BY, LIMIT in sub-selects. Fix most (not all) cases where
the grammar did not allow redundant parentheses around sub-selects. Distinguish LIMIT ALL from LIMIT 0; make the latter behave as one would expect.
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.128 2000/10/31 10:22:10 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.129 2000/11/05 00:15:52 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1826,6 +1826,7 @@ _copySelectStmt(SelectStmt *from)
|
||||
Node_Copy(from, newnode, distinctClause);
|
||||
if (from->into)
|
||||
newnode->into = pstrdup(from->into);
|
||||
newnode->istemp = from->istemp;
|
||||
Node_Copy(from, newnode, targetList);
|
||||
Node_Copy(from, newnode, fromClause);
|
||||
Node_Copy(from, newnode, whereClause);
|
||||
@ -1835,10 +1836,13 @@ _copySelectStmt(SelectStmt *from)
|
||||
if (from->portalname)
|
||||
newnode->portalname = pstrdup(from->portalname);
|
||||
newnode->binary = from->binary;
|
||||
newnode->istemp = from->istemp;
|
||||
Node_Copy(from, newnode, limitOffset);
|
||||
Node_Copy(from, newnode, limitCount);
|
||||
Node_Copy(from, newnode, forUpdate);
|
||||
newnode->op = from->op;
|
||||
newnode->all = from->all;
|
||||
Node_Copy(from, newnode, larg);
|
||||
Node_Copy(from, newnode, rarg);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.78 2000/10/31 10:22:10 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.79 2000/11/05 00:15:52 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -686,6 +686,8 @@ _equalSelectStmt(SelectStmt *a, SelectStmt *b)
|
||||
return false;
|
||||
if (!equalstr(a->into, b->into))
|
||||
return false;
|
||||
if (a->istemp != b->istemp)
|
||||
return false;
|
||||
if (!equal(a->targetList, b->targetList))
|
||||
return false;
|
||||
if (!equal(a->fromClause, b->fromClause))
|
||||
@ -702,14 +704,20 @@ _equalSelectStmt(SelectStmt *a, SelectStmt *b)
|
||||
return false;
|
||||
if (a->binary != b->binary)
|
||||
return false;
|
||||
if (a->istemp != b->istemp)
|
||||
return false;
|
||||
if (!equal(a->limitOffset, b->limitOffset))
|
||||
return false;
|
||||
if (!equal(a->limitCount, b->limitCount))
|
||||
return false;
|
||||
if (!equal(a->forUpdate, b->forUpdate))
|
||||
return false;
|
||||
if (a->op != b->op)
|
||||
return false;
|
||||
if (a->all != b->all)
|
||||
return false;
|
||||
if (!equal(a->larg, b->larg))
|
||||
return false;
|
||||
if (!equal(a->rarg, b->rarg))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user