@@ -20,79 +20,73 @@ ALTER DEFAULT PRIVILEGES FOR ROLE regress_selinto_user
2020 REVOKE INSERT ON TABLES FROM regress_selinto_user;
2121GRANT ALL ON SCHEMA selinto_schema TO public;
2222SET SESSION AUTHORIZATION regress_selinto_user;
23- SELECT * INTO TABLE selinto_schema.tmp1
24- FROM pg_class WHERE relname like '%a%';
25- ERROR: permission denied for table tmp1
26- SELECT oid AS clsoid, relname, relnatts + 10 AS x
27- INTO selinto_schema.tmp2
28- FROM pg_class WHERE relname like '%b%';
29- ERROR: permission denied for table tmp2
30- -- WITH DATA, fails
31- CREATE TABLE selinto_schema.tbl_withdata (a,b,c)
32- AS SELECT oid,relname,relacl FROM pg_class
33- WHERE relname like '%c%' WITH DATA;
34- ERROR: permission denied for table tbl_withdata
23+ -- WITH DATA, passes.
24+ CREATE TABLE selinto_schema.tbl_withdata1 (a)
25+ AS SELECT generate_series(1,3) WITH DATA;
26+ INSERT INTO selinto_schema.tbl_withdata1 VALUES (4);
27+ ERROR: permission denied for table tbl_withdata1
3528EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
36- CREATE TABLE selinto_schema.tbl_withdata (a,b,c)
37- AS SELECT oid,relname,relacl FROM pg_class
38- WHERE relname like '%c%' WITH DATA;
39- ERROR: permission denied for table tbl_withdata
29+ CREATE TABLE selinto_schema.tbl_withdata2 (a) AS
30+ SELECT generate_series(1,3) WITH DATA;
31+ QUERY PLAN
32+ --------------------------------------
33+ ProjectSet (actual rows=3 loops=1)
34+ -> Result (actual rows=1 loops=1)
35+ (2 rows)
36+
4037-- WITH NO DATA, passes.
4138CREATE TABLE selinto_schema.tbl_nodata1 (a) AS
42- SELECT oid FROM pg_class WHERE relname like '%c%' WITH NO DATA;
39+ SELECT generate_series(1,3) WITH NO DATA;
4340EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
4441 CREATE TABLE selinto_schema.tbl_nodata2 (a) AS
45- SELECT oid FROM pg_class WHERE relname like '%c%' WITH NO DATA;
46- QUERY PLAN
47- ---------------------------------------
48- Seq Scan on pg_class (never executed)
49- Filter: (relname ~~ '%c%'::text )
42+ SELECT generate_series(1,3) WITH NO DATA;
43+ QUERY PLAN
44+ -------------------------------
45+ ProjectSet (never executed)
46+ -> Result (never executed )
5047(2 rows)
5148
52- -- EXECUTE and WITH DATA, fails.
53- PREPARE data_sel AS
54- SELECT oid FROM pg_class WHERE relname like '%c%';
55- CREATE TABLE selinto_schema.tbl_withdata (a) AS
49+ -- EXECUTE and WITH DATA, passes.
50+ PREPARE data_sel AS SELECT generate_series(1,3);
51+ CREATE TABLE selinto_schema.tbl_withdata3 (a) AS
5652 EXECUTE data_sel WITH DATA;
57- ERROR: permission denied for table tbl_withdata
5853EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
59- CREATE TABLE selinto_schema.tbl_withdata (a) AS
54+ CREATE TABLE selinto_schema.tbl_withdata4 (a) AS
6055 EXECUTE data_sel WITH DATA;
61- ERROR: permission denied for table tbl_withdata
56+ QUERY PLAN
57+ --------------------------------------
58+ ProjectSet (actual rows=3 loops=1)
59+ -> Result (actual rows=1 loops=1)
60+ (2 rows)
61+
6262-- EXECUTE and WITH NO DATA, passes.
6363CREATE TABLE selinto_schema.tbl_nodata3 (a) AS
6464 EXECUTE data_sel WITH NO DATA;
6565EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
6666 CREATE TABLE selinto_schema.tbl_nodata4 (a) AS
6767 EXECUTE data_sel WITH NO DATA;
68- QUERY PLAN
69- ---------------------------------------
70- Seq Scan on pg_class (never executed)
71- Filter: (relname ~~ '%c%'::text )
68+ QUERY PLAN
69+ -------------------------------
70+ ProjectSet (never executed)
71+ -> Result (never executed )
7272(2 rows)
7373
7474RESET SESSION AUTHORIZATION;
7575ALTER DEFAULT PRIVILEGES FOR ROLE regress_selinto_user
7676 GRANT INSERT ON TABLES TO regress_selinto_user;
7777SET SESSION AUTHORIZATION regress_selinto_user;
78- SELECT * INTO TABLE selinto_schema.tmp1
79- FROM pg_class WHERE relname like '%a%'; -- OK
80- SELECT oid AS clsoid, relname, relnatts + 10 AS x
81- INTO selinto_schema.tmp2
82- FROM pg_class WHERE relname like '%b%'; -- OK
83- CREATE TABLE selinto_schema.tmp3 (a,b,c)
84- AS SELECT oid,relname,relacl FROM pg_class
85- WHERE relname like '%c%'; -- OK
8678RESET SESSION AUTHORIZATION;
79+ DEALLOCATE data_sel;
8780DROP SCHEMA selinto_schema CASCADE;
88- NOTICE: drop cascades to 7 other objects
89- DETAIL: drop cascades to table selinto_schema.tbl_nodata1
81+ NOTICE: drop cascades to 8 other objects
82+ DETAIL: drop cascades to table selinto_schema.tbl_withdata1
83+ drop cascades to table selinto_schema.tbl_withdata2
84+ drop cascades to table selinto_schema.tbl_nodata1
9085drop cascades to table selinto_schema.tbl_nodata2
86+ drop cascades to table selinto_schema.tbl_withdata3
87+ drop cascades to table selinto_schema.tbl_withdata4
9188drop cascades to table selinto_schema.tbl_nodata3
9289drop cascades to table selinto_schema.tbl_nodata4
93- drop cascades to table selinto_schema.tmp1
94- drop cascades to table selinto_schema.tmp2
95- drop cascades to table selinto_schema.tmp3
9690DROP USER regress_selinto_user;
9791-- Tests for WITH NO DATA and column name consistency
9892CREATE TABLE ctas_base (i int, j int);
0 commit comments