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

Commit cc80f0a

Browse files
committed
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.
1 parent efac279 commit cc80f0a

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/backend/parser/parse_clause.c

+2-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.168 2008/01/01 19:45:50 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.169 2008/02/15 17:19:46 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1091,9 +1091,7 @@ transformLimitClause(ParseState *pstate, Node *clause,
10911091
qual = coerce_to_specific_type(pstate, qual, INT8OID, constructName);
10921092

10931093
/*
1094-
* LIMIT can't refer to any vars or aggregates of the current query; we
1095-
* don't allow subselects either (though that case would at least be
1096-
* sensible)
1094+
* LIMIT can't refer to any vars or aggregates of the current query
10971095
*/
10981096
if (contain_vars_of_level(qual, 0))
10991097
{
@@ -1111,14 +1109,6 @@ transformLimitClause(ParseState *pstate, Node *clause,
11111109
errmsg("argument of %s must not contain aggregates",
11121110
constructName)));
11131111
}
1114-
if (contain_subplans(qual))
1115-
{
1116-
ereport(ERROR,
1117-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1118-
/* translator: %s is name of a SQL construct, eg LIMIT */
1119-
errmsg("argument of %s must not contain subqueries",
1120-
constructName)));
1121-
}
11221112

11231113
return qual;
11241114
}

0 commit comments

Comments
 (0)