mirror of
https://github.com/postgres/postgres.git
synced 2025-06-20 15:22:23 +03:00
Support data-modifying commands (INSERT/UPDATE/DELETE) in WITH.
This patch implements data-modifying WITH queries according to the semantics that the updates all happen with the same command counter value, and in an unspecified order. Therefore one WITH clause can't see the effects of another, nor can the outer query see the effects other than through the RETURNING values. And attempts to do conflicting updates will have unpredictable results. We'll need to document all that. This commit just fixes the code; documentation updates are waiting on author. Marko Tiikkaja and Hitoshi Harada
This commit is contained in:
@ -418,6 +418,20 @@ DefineView(ViewStmt *stmt, const char *queryString)
|
||||
viewParse->commandType != CMD_SELECT)
|
||||
elog(ERROR, "unexpected parse analysis result");
|
||||
|
||||
/*
|
||||
* Check for unsupported cases. These tests are redundant with ones in
|
||||
* DefineQueryRewrite(), but that function will complain about a bogus
|
||||
* ON SELECT rule, and we'd rather the message complain about a view.
|
||||
*/
|
||||
if (viewParse->intoClause != NULL)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("views must not contain SELECT INTO")));
|
||||
if (viewParse->hasModifyingCTE)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("views must not contain data-modifying statements in WITH")));
|
||||
|
||||
/*
|
||||
* If a list of column names was given, run through and insert these into
|
||||
* the actual query tree. - thomas 2000-03-08
|
||||
|
Reference in New Issue
Block a user