summaryrefslogtreecommitdiff
path: root/src/backend/commands/view.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-02-17 12:37:32 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2019-02-17 12:37:32 -0500
commit9fdc49d08fe405f0503f93849844a73517bd5cbd (patch)
tree1c9d3914dcb7ee28596b51d659bf5b473934b04e /src/backend/commands/view.c
parentbd195071fd2be49392bf1993397f638d96315ee0 (diff)
Fix CREATE VIEW to allow zero-column views.
We should logically have allowed this case when we allowed zero-column tables, but it was overlooked. Although this might be thought a feature addition, it's really a bug fix, because it was possible to create a zero-column view via the convert-table-to-view code path, and then you'd have a situation where dump/reload would fail. Hence, back-patch to all supported branches. Arrange the added test cases to provide coverage of the related pg_dump code paths (since these views will be dumped and reloaded during the pg_upgrade regression test). I also made them test the case where pg_dump has to postpone the view rule into post-data, which disturbingly had no regression coverage before. Report and patch by Ashutosh Sharma (test case by me) Discussion: https://postgr.es/m/CAE9k0PkmHdeSaeZt2ujnb_cKucmK3sDDceDzw7+d5UZoNJPYOg@mail.gmail.com
Diffstat (limited to 'src/backend/commands/view.c')
-rw-r--r--src/backend/commands/view.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index c1e1c665a7e..8378faddf58 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -109,11 +109,6 @@ DefineVirtualRelation(RangeVar *relation, List *tlist, bool replace,
}
}
- if (attrList == NIL)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
- errmsg("view must have at least one column")));
-
/*
* Look up, check permissions on, and lock the creation namespace; also
* check for a preexisting view with the same name. This will also set