1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

Fix busted Assert for CREATE MATVIEW ... WITH NO DATA.

Commit 874fe3aea changed the command tag returned for CREATE MATVIEW/CREATE
TABLE AS ... WITH NO DATA, but missed that there was code in spi.c that
expected the command tag to always be "SELECT".  Fortunately, the
consequence was only an Assert failure, so this oversight should have no
impact in production builds.

Since this code path was evidently un-exercised, add a regression test.

Per report from Shivam Saxena. Back-patch to 9.3, like the previous commit.

Michael Paquier

Report: <97218716-480B-4527-B5CD-D08D798A0C7B@dresources.com>
This commit is contained in:
Tom Lane
2016-08-11 11:22:25 -04:00
parent fd5a2db774
commit 0f249fe5f5
3 changed files with 45 additions and 2 deletions

View File

@ -2226,8 +2226,12 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
pg_strtouint64(completionTag + 7, NULL, 10);
else
{
/* Must be an IF NOT EXISTS that did nothing */
Assert(ctastmt->if_not_exists);
/*
* Must be an IF NOT EXISTS that did nothing, or a
* CREATE ... WITH NO DATA.
*/
Assert(ctastmt->if_not_exists ||
ctastmt->into->skipData);
_SPI_current->processed = 0;
}