Re: ON SELECT rule on a table without columns
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Ashutosh Sharma <ashu.coek88@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Rushabh Lathia <rushabh.lathia@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2019-02-11T10:21:56Z
Lists: pgsql-hackers
Hi, On 2019-02-11 15:39:03 +0530, Ashutosh Sharma wrote: > Andres, Tom, Please have a look into the attached patch and let me > know if I'm still missing something. Thank you. > --- a/src/test/regress/expected/create_view.out > +++ b/src/test/regress/expected/create_view.out > @@ -1706,9 +1706,16 @@ select pg_get_ruledef(oid, true) from pg_rewrite > 43 AS col_b; > (1 row) > > +-- create view on a table without columns > +create table t0(); > +create view v0 as select * from t0; > +select * from v0; > +-- > +(0 rows) I suggest also adding a view that select zero columns, where the unerlying table has columns. I think it'd be good to name the view in a way that's a bit more unique, and leaving it in place. That way pg_dump can be tested with this too (and mostly would be tested via pg_upgrade's tests). > -- clean up all the random objects we made above > \set VERBOSITY terse \\ -- suppress cascade details > DROP SCHEMA temp_view_test CASCADE; > NOTICE: drop cascades to 27 other objects > DROP SCHEMA testviewschm2 CASCADE; > -NOTICE: drop cascades to 62 other objects > +NOTICE: drop cascades to 64 other objects > diff --git a/src/test/regress/expected/matview.out b/src/test/regress/expected/matview.out > index d0121a7..f1d24e6 100644 > --- a/src/test/regress/expected/matview.out > +++ b/src/test/regress/expected/matview.out > @@ -589,3 +589,12 @@ SELECT * FROM mvtest2; > ERROR: materialized view "mvtest2" has not been populated > HINT: Use the REFRESH MATERIALIZED VIEW command. > ROLLBACK; > +-- create materialized view on a table without columns > +create table mt0(); > +create materialized view mv0 as select * from mt0; > +select * from mv0; > +-- > +(0 rows) Same. Thanks! Greetings, Andres Freund
Commits
-
Fix CREATE VIEW to allow zero-column views.
- b355be443b74 10.8 landed
- 9fdc49d08fe4 9.4.22 landed
- 1f29a1d2288a 9.6.13 landed
- 0b476cf623dd 9.5.17 landed
- a32ca7883629 12.0 landed
- 4eca1905d34b 11.3 landed