1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

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.
This commit is contained in:
Tom Lane
2010-10-15 19:53:59 -04:00
parent 6ab42ae367
commit 07f1264dda
14 changed files with 333 additions and 44 deletions

View File

@ -2313,6 +2313,7 @@ _copyInsertStmt(InsertStmt *from)
COPY_NODE_FIELD(cols);
COPY_NODE_FIELD(selectStmt);
COPY_NODE_FIELD(returningList);
COPY_NODE_FIELD(withClause);
return newnode;
}
@ -2326,6 +2327,7 @@ _copyDeleteStmt(DeleteStmt *from)
COPY_NODE_FIELD(usingClause);
COPY_NODE_FIELD(whereClause);
COPY_NODE_FIELD(returningList);
COPY_NODE_FIELD(withClause);
return newnode;
}
@ -2340,6 +2342,7 @@ _copyUpdateStmt(UpdateStmt *from)
COPY_NODE_FIELD(whereClause);
COPY_NODE_FIELD(fromClause);
COPY_NODE_FIELD(returningList);
COPY_NODE_FIELD(withClause);
return newnode;
}