Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9a540c1

Browse files
committed
Fix core dump in pg_dump --binary-upgrade on zero-column composite type.
This reverts nearly all of commit28f6cabin favor of just using the typrelid we already have in pg_dump's TypeInfostruct for the composite type. As coded, it'd crash if the composite typehad no attributes, since then the query would return no rows.Back-patch to all supported versions. It seems to not really be a problemin 9.0 because that version rejects the syntax "create type t as ()", butwe might as well keep the logic similar in all affected branches.Report and fix by Rushabh Lathia.
1 parent137e7c1 commit9a540c1

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8853,7 +8853,6 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
88538853
inti_attalign;
88548854
inti_attisdropped;
88558855
inti_attcollation;
8856-
inti_typrelid;
88578856
inti;
88588857
intactual_atts;
88598858

@@ -8874,8 +8873,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
88748873
"pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, "
88758874
"a.attlen, a.attalign, a.attisdropped, "
88768875
"CASE WHEN a.attcollation <> at.typcollation "
8877-
"THEN a.attcollation ELSE 0 END AS attcollation, "
8878-
"ct.typrelid "
8876+
"THEN a.attcollation ELSE 0 END AS attcollation "
88798877
"FROM pg_catalog.pg_type ct "
88808878
"JOIN pg_catalog.pg_attribute a ON a.attrelid = ct.typrelid "
88818879
"LEFT JOIN pg_catalog.pg_type at ON at.oid = a.atttypid "
@@ -8893,8 +8891,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
88938891
appendPQExpBuffer(query,"SELECT a.attname, "
88948892
"pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, "
88958893
"a.attlen, a.attalign, a.attisdropped, "
8896-
"0 AS attcollation, "
8897-
"ct.typrelid "
8894+
"0 AS attcollation "
88988895
"FROM pg_catalog.pg_type ct, pg_catalog.pg_attribute a "
88998896
"WHERE ct.oid = '%u'::pg_catalog.oid "
89008897
"AND a.attrelid = ct.typrelid "
@@ -8912,15 +8909,12 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
89128909
i_attalign=PQfnumber(res,"attalign");
89138910
i_attisdropped=PQfnumber(res,"attisdropped");
89148911
i_attcollation=PQfnumber(res,"attcollation");
8915-
i_typrelid=PQfnumber(res,"typrelid");
89168912

89178913
if (binary_upgrade)
89188914
{
8919-
Oidtyprelid=atooid(PQgetvalue(res,0,i_typrelid));
8920-
89218915
binary_upgrade_set_type_oids_by_type_oid(fout,q,
89228916
tyinfo->dobj.catId.oid);
8923-
binary_upgrade_set_pg_class_oids(fout,q,typrelid, false);
8917+
binary_upgrade_set_pg_class_oids(fout,q,tyinfo->typrelid, false);
89248918
}
89258919

89268920
qtypname=pg_strdup(fmtId(tyinfo->dobj.name));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp