postgresql/src/test
Tom Lane fc1286d3cb Fix rewriter to cope (more or less) with CTEs in the query being rewritten.
Since the original implementation of CTEs only allowed them in SELECT
queries, the rule rewriter did not expect to find any CTEs in statements
being rewritten by ON INSERT/UPDATE/DELETE rules.  We had dealt with this
to some extent but the code was still several bricks shy of a load, as
illustrated in bug #6051 from Jehan-Guillaume de Rorthais.

In particular, we have to be able to copy CTEs from the original query's
cteList into that of a rule action, in case the rule action references the
CTE (which it pretty much always will).  This also implies we were doing
things in the wrong order in RewriteQuery: we have to recursively rewrite
the CTE queries before expanding the main query, so that we have the
rewritten queries available to copy.

There are unpleasant limitations yet to resolve here, but at least we now
throw understandable FEATURE_NOT_SUPPORTED errors for them instead of just
failing with bizarre implementation-dependent errors.  In particular, we
can't handle propagating the same CTE into multiple post-rewrite queries
(because then the CTE would be evaluated multiple times), and we can't cope
with conflicts between CTE names in the original query and in the rule
actions.
2011-06-07 00:08:31 -04:00
..
examples Use "backend process" rather than "backend server", where appropriate. 2011-03-12 09:38:56 -05:00
isolation The row-version chaining in Serializable Snapshot Isolation was still wrong. 2011-05-30 20:47:17 +03:00
locale Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
mb Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
performance Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
regress Fix rewriter to cope (more or less) with CTEs in the query being rewritten. 2011-06-07 00:08:31 -04:00
thread Check the return code of pthread_create(). Otherwise we go into an infinite 2011-05-27 12:55:02 +03:00
Makefile Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00