Re: ON SELECT rule on a table without columns - Mailing list pgsql-hackers

From Andres Freund
Subject Re: ON SELECT rule on a table without columns
Date
Msg-id 20190211102156.s2hoadjket7pks3n@alap3.anarazel.de
Whole thread Raw
In response to Re: ON SELECT rule on a table without columns  (Ashutosh Sharma <ashu.coek88@gmail.com>)
Responses Re: ON SELECT rule on a table without columns
List 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


pgsql-hackers by date:

Previous
From: Ashutosh Sharma
Date:
Subject: Re: ON SELECT rule on a table without columns
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] Unportable implementation of background worker start