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

Commit5c38a1d

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 parent7584649 commit5c38a1d

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
@@ -9273,7 +9273,6 @@ dumpCompositeType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
92739273
inti_attalign;
92749274
inti_attisdropped;
92759275
inti_attcollation;
9276-
inti_typrelid;
92779276
inti;
92789277
intactual_atts;
92799278

@@ -9294,8 +9293,7 @@ dumpCompositeType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
92949293
"pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, "
92959294
"a.attlen, a.attalign, a.attisdropped, "
92969295
"CASE WHEN a.attcollation <> at.typcollation "
9297-
"THEN a.attcollation ELSE 0 END AS attcollation, "
9298-
"ct.typrelid "
9296+
"THEN a.attcollation ELSE 0 END AS attcollation "
92999297
"FROM pg_catalog.pg_type ct "
93009298
"JOIN pg_catalog.pg_attribute a ON a.attrelid = ct.typrelid "
93019299
"LEFT JOIN pg_catalog.pg_type at ON at.oid = a.atttypid "
@@ -9313,8 +9311,7 @@ dumpCompositeType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
93139311
appendPQExpBuffer(query,"SELECT a.attname, "
93149312
"pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, "
93159313
"a.attlen, a.attalign, a.attisdropped, "
9316-
"0 AS attcollation, "
9317-
"ct.typrelid "
9314+
"0 AS attcollation "
93189315
"FROM pg_catalog.pg_type ct, pg_catalog.pg_attribute a "
93199316
"WHERE ct.oid = '%u'::pg_catalog.oid "
93209317
"AND a.attrelid = ct.typrelid "
@@ -9332,15 +9329,12 @@ dumpCompositeType(Archive *fout, DumpOptions *dopt, TypeInfo *tyinfo)
93329329
i_attalign=PQfnumber(res,"attalign");
93339330
i_attisdropped=PQfnumber(res,"attisdropped");
93349331
i_attcollation=PQfnumber(res,"attcollation");
9335-
i_typrelid=PQfnumber(res,"typrelid");
93369332

93379333
if (dopt->binary_upgrade)
93389334
{
9339-
Oidtyprelid=atooid(PQgetvalue(res,0,i_typrelid));
9340-
93419335
binary_upgrade_set_type_oids_by_type_oid(fout,q,
93429336
tyinfo->dobj.catId.oid);
9343-
binary_upgrade_set_pg_class_oids(fout,q,typrelid, false);
9337+
binary_upgrade_set_pg_class_oids(fout,q,tyinfo->typrelid, false);
93449338
}
93459339

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp