Allow WITH clauses to be attached to INSERT, UPDATE, DELETE statements.
Tom Lane <tgl@sss.pgh.pa.us>
Allow WITH clauses to be attached to INSERT, UPDATE, DELETE statements. This is not the hoped-for facility of using INSERT/UPDATE/DELETE inside a WITH, but rather the other way around. It seems useful in its own right anyway. Note: catversion bumped because, although the contents of stored rules might look compatible, there's actually a subtle semantic change. A single Query containing a WITH and INSERT...VALUES now represents writing the WITH before the INSERT, not before the VALUES. While it's not clear that that matters to anyone, it seems like a good idea to have it cited in the git history for catversion.h. Original patch by Marko Tiikkaja, with updating and cleanup by Hitoshi Harada.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/queries.sgml | modified | +12 −4 |
| doc/src/sgml/ref/delete.sgml | modified | +15 −1 |
| doc/src/sgml/ref/insert.sgml | modified | +24 −1 |
| doc/src/sgml/ref/update.sgml | modified | +15 −1 |
| src/backend/nodes/copyfuncs.c | modified | +3 −0 |
| src/backend/nodes/equalfuncs.c | modified | +3 −0 |
| src/backend/parser/analyze.c | modified | +24 −16 |
| src/backend/parser/gram.y | modified | +24 −16 |
| src/backend/parser/parse_utilcmd.c | modified | +29 −0 |
| src/backend/utils/adt/ruleutils.c | modified | +9 −4 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/nodes/parsenodes.h | modified | +3 −0 |
| src/test/regress/expected/with.out | modified | +133 −0 |
| src/test/regress/sql/with.sql | modified | +38 −0 |