mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +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:
@@ -896,6 +896,7 @@ typedef struct InsertStmt
|
||||
List *cols; /* optional: names of the target columns */
|
||||
Node *selectStmt; /* the source SELECT/VALUES, or NULL */
|
||||
List *returningList; /* list of expressions to return */
|
||||
WithClause *withClause; /* WITH clause */
|
||||
} InsertStmt;
|
||||
|
||||
/* ----------------------
|
||||
@@ -909,6 +910,7 @@ typedef struct DeleteStmt
|
||||
List *usingClause; /* optional using clause for more tables */
|
||||
Node *whereClause; /* qualifications */
|
||||
List *returningList; /* list of expressions to return */
|
||||
WithClause *withClause; /* WITH clause */
|
||||
} DeleteStmt;
|
||||
|
||||
/* ----------------------
|
||||
@@ -923,6 +925,7 @@ typedef struct UpdateStmt
|
||||
Node *whereClause; /* qualifications */
|
||||
List *fromClause; /* optional from clause for more tables */
|
||||
List *returningList; /* list of expressions to return */
|
||||
WithClause *withClause; /* WITH clause */
|
||||
} UpdateStmt;
|
||||
|
||||
/* ----------------------
|
||||
|
||||
Reference in New Issue
Block a user