!2174 修复dump在非B兼容模式下导出视图时会把definer也导出的bug
Merge pull request !2174 from Cross-罗/dump_bugfix
This commit is contained in:
@ -18091,7 +18091,8 @@ static void dumpViewSchema(
|
||||
|
||||
/* set definer for CREATE VIEW statement */
|
||||
appendPQExpBuffer(q, "CREATE ");
|
||||
if (tbinfo->rolname != NULL && strlen(tbinfo->rolname) > 0) {
|
||||
if ((gdatcompatibility != NULL) && strcmp(gdatcompatibility, B_FORMAT) == 0 &&
|
||||
tbinfo->rolname != NULL && strlen(tbinfo->rolname) > 0) {
|
||||
appendPQExpBuffer(q, " DEFINER = %s ", tbinfo->rolname);
|
||||
}
|
||||
appendPQExpBuffer(q, " VIEW %s(%s)", fmtId(tbinfo->dobj.name), schemainfo);
|
||||
|
||||
@ -45,8 +45,21 @@ SELECT c.relname as view_name, u.usename as rolname FROM pg_class c, pg_user u W
|
||||
|
||||
RESET ROLE;
|
||||
|
||||
create database test_1;
|
||||
\c test_1
|
||||
create table startwith_t(id int, level int, connect_by_isleaf int, connect_by_iscycle int);
|
||||
create view startwith_v as select id, connect_by_isleaf as level, level as connect_by_isleaf from startwith_t;
|
||||
|
||||
\! @abs_bindir@/gs_dump test_1 -p @portstring@ -f @abs_bindir@/dump_postgres.sql
|
||||
drop database if exists test_2;
|
||||
create database test_2;
|
||||
\! @abs_bindir@/gsql -d test_2 -p @portstring@ -f @abs_bindir@/dump_postgres.sql
|
||||
\! @abs_bindir@/gsql -d test_2 -p @portstring@ -c "select * from startwith_v;"
|
||||
|
||||
\c regression
|
||||
drop database test_db;
|
||||
drop database test_1;
|
||||
drop database test_2;
|
||||
DROP USER test_user;
|
||||
DROP USER test_user2;
|
||||
DROP USER root_test CASCADE;
|
||||
|
||||
@ -101,8 +101,46 @@ SELECT c.relname as view_name, u.usename as rolname FROM pg_class c, pg_user u W
|
||||
(3 rows)
|
||||
|
||||
RESET ROLE;
|
||||
create database test_1;
|
||||
\c test_1
|
||||
create table startwith_t(id int, level int, connect_by_isleaf int, connect_by_iscycle int);
|
||||
create view startwith_v as select id, connect_by_isleaf as level, level as connect_by_isleaf from startwith_t;
|
||||
\! @abs_bindir@/gs_dump test_1 -p @portstring@ -f @abs_bindir@/dump_postgres.sql
|
||||
--?.*
|
||||
--?.*
|
||||
--?.*
|
||||
--?.*
|
||||
drop database if exists test_2;
|
||||
NOTICE: database "test_2" does not exist, skipping
|
||||
create database test_2;
|
||||
\! @abs_bindir@/gsql -d test_2 -p @portstring@ -f @abs_bindir@/dump_postgres.sql
|
||||
SET
|
||||
SET
|
||||
SET
|
||||
SET
|
||||
SET
|
||||
SET
|
||||
SET
|
||||
SET
|
||||
SET
|
||||
CREATE TABLE
|
||||
ALTER TABLE
|
||||
CREATE VIEW
|
||||
ALTER VIEW
|
||||
REVOKE
|
||||
REVOKE
|
||||
GRANT
|
||||
GRANT
|
||||
--?.*
|
||||
\! @abs_bindir@/gsql -d test_2 -p @portstring@ -c "select * from startwith_v;"
|
||||
id | level | connect_by_isleaf
|
||||
----+-------+-------------------
|
||||
(0 rows)
|
||||
|
||||
\c regression
|
||||
drop database test_db;
|
||||
drop database test_1;
|
||||
drop database test_2;
|
||||
DROP USER test_user;
|
||||
DROP USER test_user2;
|
||||
DROP USER root_test CASCADE;
|
||||
|
||||
Reference in New Issue
Block a user