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

Commit31021e7

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 parent870a980 commit31021e7

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7309,7 +7309,6 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
73097309
intntups;
73107310
inti_attname;
73117311
inti_atttypdefn;
7312-
inti_typrelid;
73137312
inti;
73147313

73157314
/* Set proper schema search path so type references list correctly */
@@ -7319,8 +7318,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
73197318
/* We assume here that remoteVersion must be at least 70300 */
73207319

73217320
appendPQExpBuffer(query,"SELECT a.attname, "
7322-
"pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, "
7323-
"typrelid "
7321+
"pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn "
73247322
"FROM pg_catalog.pg_type t, pg_catalog.pg_attribute a "
73257323
"WHERE t.oid = '%u'::pg_catalog.oid "
73267324
"AND a.attrelid = t.typrelid "
@@ -7341,14 +7339,11 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
73417339

73427340
i_attname=PQfnumber(res,"attname");
73437341
i_atttypdefn=PQfnumber(res,"atttypdefn");
7344-
i_typrelid=PQfnumber(res,"typrelid");
73457342

73467343
if (binary_upgrade)
73477344
{
7348-
Oidtyprelid=atooid(PQgetvalue(res,0,i_typrelid));
7349-
73507345
binary_upgrade_set_type_oids_by_type_oid(q,tyinfo->dobj.catId.oid);
7351-
binary_upgrade_set_relfilenodes(q,typrelid, false);
7346+
binary_upgrade_set_relfilenodes(q,tyinfo->typrelid, false);
73527347
}
73537348

73547349
appendPQExpBuffer(q,"CREATE TYPE %s AS (",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp