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

Commit88800aa

Browse files
committed
Ok. BTW Mr. Kataoka who is maintaing Japanese version of PostgreSQL
ODBC driver have found a bug in 6.3.2 pg_dump and have made patches.I confirmed that the same bug still exists in the current sourcetree. So I made up patches based on Kataoka's. Here are someexplanations.o fmtId() returns pointer to a static memory in it. In the meantimethere is a line where is fmtId() called twice without saving thefirst value returned by fmtId(). So second call to fmtId() willbreak the first one.o findTableByName() looks up a table by its name. if a table namecontanins upper letters or non ascii chars, fmtId() will returnsa name quoted in double quotes, which will not what findTableByName()wants. The result is SEG fault. -- Tatsuo Ishii t-ishii@sra.co.jp
1 parent2618fcd commit88800aa

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.80 1998/08/25 15:02:04 thomas Exp $
24+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.81 1998/08/29 18:06:57 momjian Exp $
2525
*
2626
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2727
*
@@ -2435,7 +2435,9 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
24352435
inti,
24362436
j,
24372437
k;
2438-
charq[MAXQUERYLEN];
2438+
charq[MAXQUERYLEN],
2439+
id1[MAXQUERYLEN],
2440+
id2[MAXQUERYLEN];
24392441
char**parentRels;/* list of names of parent relations */
24402442
intnumParents;
24412443
intactual_atts;/* number of attrs in this CREATE statment */
@@ -2506,11 +2508,13 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
25062508
}
25072509
else
25082510
{
2511+
strcpy(id1,fmtId(tblinfo[i].attnames[j]));
2512+
strcpy(id2,fmtId(tblinfo[i].typnames[j]));
25092513
sprintf(q,"%s%s%s %s",
25102514
q,
25112515
(actual_atts>0) ?", " :"",
2512-
fmtId(tblinfo[i].attnames[j]),
2513-
fmtId(tblinfo[i].typnames[j]));
2516+
id1,
2517+
id2);
25142518
actual_atts++;
25152519
}
25162520
if (tblinfo[i].adef_expr[j]!=NULL)
@@ -2572,13 +2576,15 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
25722576
indclass;
25732577
intnclass;
25742578

2575-
charq[MAXQUERYLEN];
2579+
charq[MAXQUERYLEN],
2580+
id1[MAXQUERYLEN],
2581+
id2[MAXQUERYLEN];
25762582
PGresult*res;
25772583

25782584
for (i=0;i<numIndices;i++)
25792585
{
25802586
tableInd=findTableByName(tblinfo,numTables,
2581-
fmtId(indinfo[i].indrelname));
2587+
(indinfo[i].indrelname));
25822588

25832589
if (strcmp(indinfo[i].indproc,"0")==0)
25842590
funcname=NULL;
@@ -2659,19 +2665,23 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
26592665
attname,indinfo[i].indexrelname);
26602666
exit_nicely(g_conn);
26612667
}
2668+
strcpy(id1,fmtId(attname));
2669+
strcpy(id2,fmtId(classname[k]));
26622670
sprintf(attlist+strlen(attlist),"%s%s %s",
2663-
(k==0) ?"" :", ",fmtId(attname),fmtId(classname[k]));
2671+
(k==0) ?"" :", ",id1,id2);
26642672
free(classname[k]);
26652673
}
26662674
}
26672675

26682676
if (!tablename|| (!strcmp(indinfo[i].indrelname,tablename)))
26692677
{
26702678

2679+
strcpy(id1,fmtId(indinfo[i].indexrelname));
2680+
strcpy(id2,fmtId(indinfo[i].indrelname));
26712681
sprintf(q,"CREATE %s INDEX %s on %s using %s (",
26722682
(strcmp(indinfo[i].indisunique,"t")==0) ?"UNIQUE" :"",
2673-
fmtId(indinfo[i].indexrelname),
2674-
fmtId(indinfo[i].indrelname),
2683+
id1,
2684+
id2,
26752685
indinfo[i].indamname);
26762686
if (funcname)
26772687
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp