aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-08-11 11:22:25 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-08-11 11:22:25 -0400
commit894993ffee387383b371ebc515b5e8ea156f9574 (patch)
tree0ab5cdca8d9e1815a521c88da909f146a21ec6fb /src/backend/executor
parenta470858078e129641de24f5d090632f76b055cd8 (diff)
downloadpostgresql-894993ffee387383b371ebc515b5e8ea156f9574.tar.gz
postgresql-894993ffee387383b371ebc515b5e8ea156f9574.zip
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>
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/spi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index dc039f41748..0eba31d0d0e 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -2224,8 +2224,12 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
strtoul(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;
}