Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cherry-pick 19870 and 20093 #20116

Open
wants to merge 2 commits into from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions e2e_test/ddl/alter_owner.slt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ v user1
statement ok
CREATE MATERIALIZED VIEW mv AS SELECT v1, (t.v2).v1 AS v21 FROM t;

statement ok
CREATE INDEX mv_idx ON mv(v1);

statement ok
ALTER MATERIALIZED VIEW mv OWNER TO user1;

Expand All @@ -85,6 +88,21 @@ WHERE
----
mv user1

query TT
SELECT
pg_class.relname AS rel_name,
pg_roles.rolname AS owner
FROM
pg_class
JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace
JOIN pg_roles ON pg_roles.oid = pg_class.relowner
WHERE
pg_namespace.nspname NOT LIKE 'pg_%'
AND pg_namespace.nspname != 'information_schema'
AND pg_class.relname = 'mv_idx';
----
mv_idx user1

statement ok
CREATE SOURCE src (v INT) WITH (
connector = 'datagen',
Expand Down
12 changes: 11 additions & 1 deletion e2e_test/ddl/alter_set_schema.slt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,21 @@ CREATE INDEX test_index1 ON test_table(u);
statement ok
CREATE INDEX test_index2 ON test_table(v);

statement ok
CREATE MATERIALIZED VIEW test_mv AS SELECT u FROM test_table;

statement ok
CREATE INDEX test_mv_index ON test_mv(u);

statement ok
ALTER TABLE test_table SET SCHEMA public;

statement ok
ALTER TABLE test_table SET SCHEMA test_schema;

statement ok
ALTER MATERIALIZED VIEW test_mv SET SCHEMA test_schema;

query TT
SELECT tablename, schemaname FROM pg_tables WHERE schemaname = 'test_schema';
----
Expand All @@ -39,6 +48,7 @@ SELECT indexname, schemaname FROM pg_indexes WHERE schemaname = 'test_schema';
----
test_index1 test_schema
test_index2 test_schema
test_mv_index test_schema

statement ok
CREATE SOURCE test_source (v INT) WITH (
Expand Down Expand Up @@ -104,7 +114,7 @@ statement ok
DROP SOURCE test_schema.test_source;

statement ok
DROP TABLE test_schema.test_table;
DROP TABLE test_schema.test_table cascade;

statement ok
DROP SCHEMA test_schema;
Loading
Loading