mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
Remove ancient restriction that LIMIT/OFFSET can't contain a sub-select.
This was probably protecting some implementation limitation when it was put in, but as far as I can tell the planner and executor have no such assumption anymore; the case seems to work fine. Per a gripe from Grzegorz Jaskiewicz.
This commit is contained in:
parent
efac2796e6
commit
cc80f0a340
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.168 2008/01/01 19:45:50 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.169 2008/02/15 17:19:46 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1091,9 +1091,7 @@ transformLimitClause(ParseState *pstate, Node *clause,
|
|||||||
qual = coerce_to_specific_type(pstate, qual, INT8OID, constructName);
|
qual = coerce_to_specific_type(pstate, qual, INT8OID, constructName);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LIMIT can't refer to any vars or aggregates of the current query; we
|
* LIMIT can't refer to any vars or aggregates of the current query
|
||||||
* don't allow subselects either (though that case would at least be
|
|
||||||
* sensible)
|
|
||||||
*/
|
*/
|
||||||
if (contain_vars_of_level(qual, 0))
|
if (contain_vars_of_level(qual, 0))
|
||||||
{
|
{
|
||||||
@ -1111,14 +1109,6 @@ transformLimitClause(ParseState *pstate, Node *clause,
|
|||||||
errmsg("argument of %s must not contain aggregates",
|
errmsg("argument of %s must not contain aggregates",
|
||||||
constructName)));
|
constructName)));
|
||||||
}
|
}
|
||||||
if (contain_subplans(qual))
|
|
||||||
{
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
|
||||||
/* translator: %s is name of a SQL construct, eg LIMIT */
|
|
||||||
errmsg("argument of %s must not contain subqueries",
|
|
||||||
constructName)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return qual;
|
return qual;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user