mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-03 03:56:53 +02:00
Collect attribute data on extension owned tables being dumped
If this data is not collected, pg_dump segfaults if asked for column inserts. Fix by Fabrízio de Royes Mello Backpatch to release 12 where the bug was introduced.
This commit is contained in:
parent
56f42cf906
commit
616110eac3
@ -2036,6 +2036,8 @@ dumpTableData_insert(Archive *fout, void *dcontext)
|
||||
if (nfields == 0)
|
||||
continue;
|
||||
|
||||
Assert(tbinfo->attgenerated);
|
||||
|
||||
/* Emit a row heading */
|
||||
if (rows_per_statement == 1)
|
||||
archputs(" (", fout);
|
||||
@ -18010,6 +18012,8 @@ processExtensionTables(Archive *fout, ExtensionInfo extinfo[],
|
||||
configtbl->dataObj->filtercond = pg_strdup(extconditionarray[j]);
|
||||
}
|
||||
}
|
||||
|
||||
configtbl->interesting = dumpobj;
|
||||
}
|
||||
}
|
||||
if (extconfigarray)
|
||||
|
@ -135,6 +135,12 @@ my %pgdump_runs = (
|
||||
"$tempdir/defaults_tar_format.tar",
|
||||
],
|
||||
},
|
||||
extension_schema => {
|
||||
dump_cmd => [
|
||||
'pg_dump', '--schema=public', '--inserts',
|
||||
"--file=$tempdir/extension_schema.sql", 'postgres',
|
||||
],
|
||||
},
|
||||
pg_dumpall_globals => {
|
||||
dump_cmd => [
|
||||
'pg_dumpall', '--no-sync',
|
||||
@ -303,6 +309,7 @@ my %tests = (
|
||||
%full_runs,
|
||||
data_only => 1,
|
||||
section_data => 1,
|
||||
extension_schema => 1,
|
||||
},
|
||||
},
|
||||
|
||||
@ -536,6 +543,7 @@ my %tests = (
|
||||
like => {%pgdump_runs},
|
||||
unlike => {
|
||||
data_only => 1,
|
||||
extension_schema => 1,
|
||||
pg_dumpall_globals => 1,
|
||||
section_data => 1,
|
||||
section_pre_data => 1,
|
||||
@ -549,6 +557,7 @@ my %tests = (
|
||||
like => {%pgdump_runs},
|
||||
unlike => {
|
||||
data_only => 1,
|
||||
extension_schema => 1,
|
||||
pg_dumpall_globals => 1,
|
||||
section_data => 1,
|
||||
section_pre_data => 1,
|
||||
@ -569,6 +578,17 @@ my %tests = (
|
||||
schema_only => 1,
|
||||
section_pre_data => 1,
|
||||
},
|
||||
},
|
||||
|
||||
# Dumpable object inside specific schema
|
||||
'INSERT INTO public.regress_table_dumpable VALUES (1);' => {
|
||||
create_sql => 'INSERT INTO public.regress_table_dumpable VALUES (1);',
|
||||
regexp => qr/^
|
||||
\QINSERT INTO public.regress_table_dumpable VALUES (1);\E
|
||||
\n/xm,
|
||||
like => {
|
||||
extension_schema => 1,
|
||||
},
|
||||
},);
|
||||
|
||||
#########################################
|
||||
|
@ -13,6 +13,11 @@ CREATE SEQUENCE regress_pg_dump_seq;
|
||||
CREATE SEQUENCE regress_seq_dumpable;
|
||||
SELECT pg_catalog.pg_extension_config_dump('regress_seq_dumpable', '');
|
||||
|
||||
CREATE TABLE regress_table_dumpable (
|
||||
col1 int
|
||||
);
|
||||
SELECT pg_catalog.pg_extension_config_dump('regress_table_dumpable', '');
|
||||
|
||||
CREATE SCHEMA regress_pg_dump_schema;
|
||||
|
||||
GRANT USAGE ON regress_pg_dump_seq TO regress_dump_test_role;
|
||||
|
Loading…
Reference in New Issue
Block a user