Re: ON SELECT rule on a table without columns

From: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ON SELECT rule on a table without columns
Date: 2019-02-11 12:20:42
Message-ID: CAE9k0Pk3a1vNEaR2V+6iOMLoKkR1p8x8v2X0jNJVVPgCp0Z6Wg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks Andres for the quick review.

On Mon, Feb 11, 2019 at 3:52 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> 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.
>

Done.

> 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).
>

Renamed view to something like -> 'view_no_column' and
'view_zero_column' and didn't drop it so that it so that it gets
tested with pg_upgrade.

>
> > -- 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.
>
>

Done.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

Attachment Content-Type Size
allow-create-view-on-table-without-columns-v3.patch application/octet-stream 6.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2019-02-11 12:53:35 Re: [PATCH v20] GSSAPI encryption support
Previous Message John Naylor 2019-02-11 11:44:39 Re: Why don't we have a small reserved OID range for patch revisions?