1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Add pg_dump support for ALTER obj DEPENDS ON EXTENSION

pg_dump is oblivious to this kind of dependency, so they're lost on
dump/restores (and pg_upgrade).  Have pg_dump emit ALTER lines so that
they're preserved.  Add some pg_dump tests for the whole thing, also.

Reviewed-by: Tom Lane (offlist)
Reviewed-by: Ibrar Ahmed
Reviewed-by: Ahsan Hadi (who also reviewed commit 899a04f5ed)
Discussion: https://postgr.es/m/20200217225333.GA30974@alvherre.pgsql
This commit is contained in:
Alvaro Herrera
2020-03-11 16:54:54 -03:00
parent 3c8864fc1c
commit f977e6dec8
4 changed files with 133 additions and 8 deletions

View File

@ -523,6 +523,38 @@ my %tests = (
like => { binary_upgrade => 1, },
},
'ALTER INDEX pkey DEPENDS ON extension' => {
create_order => 11,
create_sql =>
'CREATE TABLE regress_pg_dump_schema.extdependtab (col1 integer primary key, col2 int);
CREATE INDEX ON regress_pg_dump_schema.extdependtab (col2);
ALTER INDEX regress_pg_dump_schema.extdependtab_col2_idx DEPENDS ON EXTENSION test_pg_dump;
ALTER INDEX regress_pg_dump_schema.extdependtab_pkey DEPENDS ON EXTENSION test_pg_dump;',
regexp => qr/^
\QALTER INDEX regress_pg_dump_schema.extdependtab_pkey DEPENDS ON EXTENSION test_pg_dump;\E\n
/xms,
like => {%pgdump_runs},
unlike => {
data_only => 1,
pg_dumpall_globals => 1,
section_data => 1,
section_pre_data => 1,
},
},
'ALTER INDEX idx DEPENDS ON extension' => {
regexp => qr/^
\QALTER INDEX regress_pg_dump_schema.extdependtab_col2_idx DEPENDS ON EXTENSION test_pg_dump;\E\n
/xms,
like => {%pgdump_runs},
unlike => {
data_only => 1,
pg_dumpall_globals => 1,
section_data => 1,
section_pre_data => 1,
},
},
# Objects not included in extension, part of schema created by extension
'CREATE TABLE regress_pg_dump_schema.external_tab' => {
create_order => 4,