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

Commit6c37303

Browse files
committed
pg_dump fix
1 parent773358e commit6c37303

File tree

2 files changed

+41
-25
lines changed

2 files changed

+41
-25
lines changed

‎src/backend/access/index/genam.c

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -247,33 +247,35 @@ BuildIndexValueDescription(Relation indexRelation,
247247
appendStringInfo(&buf,"(%s)=(",
248248
pg_get_indexdef_columns(indexrelid, true));
249249

250-
char*val;
251-
252-
if (isnull[i])
253-
val="null";
254-
else
250+
for (i=0;i<indnkeyatts;i++)
255251
{
256-
Oidfoutoid;
257-
booltypisvarlena;
258-
/*
259-
* The provided data is not necessarily of the type stored in the
260-
* index; rather it is of the index opclass's input type. So look
261-
* at rd_opcintype not the index tupdesc.
262-
*
263-
* Note: this is a bit shaky for opclasses that have pseudotype
264-
* input types such as ANYARRAY or RECORD. Currently, the
265-
* typoutput functions associated with the pseudotypes will work
266-
* okay, but we might have to try harder in future.
267-
*/
268-
getTypeOutputInfo(indexRelation->rd_opcintype[i],
269-
&foutoid,&typisvarlena);
270-
val=OidOutputFunctionCall(foutoid,values[i]);
271-
}
252+
char*val;
272253

273-
if (i>0)
274-
appendStringInfoString(&buf,", ");
275-
appendStringInfoString(&buf,val);
254+
if (isnull[i])
255+
val="null";
256+
else
257+
{
258+
Oidfoutoid;
259+
booltypisvarlena;
260+
/*
261+
* The provided data is not necessarily of the type stored in the
262+
* index; rather it is of the index opclass's input type. So look
263+
* at rd_opcintype not the index tupdesc.
264+
*
265+
* Note: this is a bit shaky for opclasses that have pseudotype
266+
* input types such as ANYARRAY or RECORD. Currently, the
267+
* typoutput functions associated with the pseudotypes will work
268+
* okay, but we might have to try harder in future.
269+
*/
270+
getTypeOutputInfo(indexRelation->rd_opcintype[i],
271+
&foutoid,&typisvarlena);
272+
val=OidOutputFunctionCall(foutoid,values[i]);
273+
}
276274

275+
if (i>0)
276+
appendStringInfoString(&buf,", ");
277+
appendStringInfoString(&buf,val);
278+
}
277279
appendStringInfoChar(&buf,')');
278280

279281
returnbuf.data;

‎src/bin/pg_dump/pg_dump.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5444,7 +5444,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
54445444
/*
54455445
* In PGPRO_9.5.2 we add INCLUDING columns functionality
54465446
* that requires new fields to be added.
5447-
* i.indnkeyattrs is new, and besides we should use
5447+
* i.indnkeyatts is new, and besides we should use
54485448
* i.indnatts instead of t.relnatts for index relations.
54495449
*
54505450
*/
@@ -5484,6 +5484,8 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
54845484
"SELECT t.tableoid, t.oid, "
54855485
"t.relname AS indexname, "
54865486
"pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, "
5487+
"NULL AS indnkeyatts, "
5488+
"NULL AS indnatts, "
54875489
"t.relnatts AS indnkeys, "
54885490
"i.indkey, i.indisclustered, "
54895491
"i.indisreplident, t.relpages, "
@@ -5515,6 +5517,8 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
55155517
"SELECT t.tableoid, t.oid, "
55165518
"t.relname AS indexname, "
55175519
"pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, "
5520+
"NULL AS indnkeyatts, "
5521+
"NULL AS indnatts, "
55185522
"t.relnatts AS indnkeys, "
55195523
"i.indkey, i.indisclustered, "
55205524
"false AS indisreplident, t.relpages, "
@@ -5542,6 +5546,8 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
55425546
"SELECT t.tableoid, t.oid, "
55435547
"t.relname AS indexname, "
55445548
"pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, "
5549+
"NULL AS indnkeyatts, "
5550+
"NULL AS indnatts, "
55455551
"t.relnatts AS indnkeys, "
55465552
"i.indkey, i.indisclustered, "
55475553
"false AS indisreplident, t.relpages, "
@@ -5572,6 +5578,8 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
55725578
"SELECT t.tableoid, t.oid, "
55735579
"t.relname AS indexname, "
55745580
"pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, "
5581+
"NULL AS indnkeyatts, "
5582+
"NULL AS indnatts, "
55755583
"t.relnatts AS indnkeys, "
55765584
"i.indkey, i.indisclustered, "
55775585
"false AS indisreplident, t.relpages, "
@@ -5601,6 +5609,8 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
56015609
"SELECT t.tableoid, t.oid, "
56025610
"t.relname AS indexname, "
56035611
"pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, "
5612+
"NULL AS indnkeyatts, "
5613+
"NULL AS indnatts, "
56045614
"t.relnatts AS indnkeys, "
56055615
"i.indkey, i.indisclustered, "
56065616
"false AS indisreplident, t.relpages, "
@@ -5630,6 +5640,8 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
56305640
"SELECT t.tableoid, t.oid, "
56315641
"t.relname AS indexname, "
56325642
"pg_get_indexdef(i.indexrelid) AS indexdef, "
5643+
"NULL AS indnkeyatts, "
5644+
"NULL AS indnatts, "
56335645
"t.relnatts AS indnkeys, "
56345646
"i.indkey, false AS indisclustered, "
56355647
"false AS indisreplident, t.relpages, "
@@ -5657,6 +5669,8 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
56575669
"t.oid, "
56585670
"t.relname AS indexname, "
56595671
"pg_get_indexdef(i.indexrelid) AS indexdef, "
5672+
"NULL AS indnkeyatts, "
5673+
"NULL AS indnatts, "
56605674
"t.relnatts AS indnkeys, "
56615675
"i.indkey, false AS indisclustered, "
56625676
"false AS indisreplident, t.relpages, "

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp