diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-10-07 19:27:04 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-10-07 19:27:04 +0000 |
commit | 0d115dde82bf368ae0f9755113bd8fd53ac0b64b (patch) | |
tree | a6a1b7b4cfcf1b8ecd49ec280898fc678efdd67d /src/backend/parser | |
parent | 059349be0c7fb2bfc1076d70c8307f5e31d8ff59 (diff) | |
download | postgresql-0d115dde82bf368ae0f9755113bd8fd53ac0b64b.tar.gz postgresql-0d115dde82bf368ae0f9755113bd8fd53ac0b64b.zip |
Extend CTE patch to support recursive UNION (ie, without ALL). The
implementation uses an in-memory hash table, so it will poop out for very
large recursive results ... but the performance characteristics of a
sort-based implementation would be pretty unpleasant too.
Diffstat (limited to 'src/backend/parser')
-rw-r--r-- | src/backend/parser/parse_cte.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/parser/parse_cte.c b/src/backend/parser/parse_cte.c index 29111acb968..3971dac23f7 100644 --- a/src/backend/parser/parse_cte.c +++ b/src/backend/parser/parse_cte.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_cte.c,v 2.2 2008/10/05 22:50:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_cte.c,v 2.3 2008/10/07 19:27:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -601,11 +601,11 @@ checkWellFormedRecursion(CteState *cstate) if (!cte->cterecursive) continue; - /* Must have top-level UNION ALL */ - if (stmt->op != SETOP_UNION || !stmt->all) + /* Must have top-level UNION */ + if (stmt->op != SETOP_UNION) ereport(ERROR, (errcode(ERRCODE_INVALID_RECURSION), - errmsg("recursive query \"%s\" does not have the form non-recursive-term UNION ALL recursive-term", + errmsg("recursive query \"%s\" does not have the form non-recursive-term UNION [ALL] recursive-term", cte->ctename), parser_errposition(cstate->pstate, cte->location))); @@ -628,7 +628,7 @@ checkWellFormedRecursion(CteState *cstate) elog(ERROR, "missing recursive reference"); /* - * Disallow ORDER BY and similar decoration atop the UNION ALL. + * Disallow ORDER BY and similar decoration atop the UNION. * These don't make sense because it's impossible to figure out what * they mean when we have only part of the recursive query's results. * (If we did allow them, we'd have to check for recursive references |