aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-08-29 18:06:57 +0000
committerBruce Momjian <bruce@momjian.us>1998-08-29 18:06:57 +0000
commit88800aac14c54f595d288be0e1fac8720f5f5b5d (patch)
treeeeb99c78319a0562275e01fa3a480b2fabf181c7 /src
parent2618fcdf0d563daf958336978fd2559c9d82ea9f (diff)
downloadpostgresql-88800aac14c54f595d288be0e1fac8720f5f5b5d.tar.gz
postgresql-88800aac14c54f595d288be0e1fac8720f5f5b5d.zip
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 source tree. So I made up patches based on Kataoka's. Here are some explanations. o fmtId() returns pointer to a static memory in it. In the meantime there is a line where is fmtId() called twice without saving the first value returned by fmtId(). So second call to fmtId() will break the first one. o findTableByName() looks up a table by its name. if a table name contanins upper letters or non ascii chars, fmtId() will returns a name quoted in double quotes, which will not what findTableByName() wants. The result is SEG fault. -- Tatsuo Ishii t-ishii@sra.co.jp
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_dump.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 16ce8eaff8e..e6b448feaef 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -21,7 +21,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.80 1998/08/25 15:02:04 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.81 1998/08/29 18:06:57 momjian Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
@@ -2435,7 +2435,9 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
int i,
j,
k;
- char q[MAXQUERYLEN];
+ char q[MAXQUERYLEN],
+ id1[MAXQUERYLEN],
+ id2[MAXQUERYLEN];
char **parentRels; /* list of names of parent relations */
int numParents;
int actual_atts; /* number of attrs in this CREATE statment */
@@ -2506,11 +2508,13 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
}
else
{
+ strcpy(id1, fmtId(tblinfo[i].attnames[j]));
+ strcpy(id2, fmtId(tblinfo[i].typnames[j]));
sprintf(q, "%s%s%s %s",
q,
(actual_atts > 0) ? ", " : "",
- fmtId(tblinfo[i].attnames[j]),
- fmtId(tblinfo[i].typnames[j]));
+ id1,
+ id2);
actual_atts++;
}
if (tblinfo[i].adef_expr[j] != NULL)
@@ -2572,13 +2576,15 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
indclass;
int nclass;
- char q[MAXQUERYLEN];
+ char q[MAXQUERYLEN],
+ id1[MAXQUERYLEN],
+ id2[MAXQUERYLEN];
PGresult *res;
for (i = 0; i < numIndices; i++)
{
tableInd = findTableByName(tblinfo, numTables,
- fmtId(indinfo[i].indrelname));
+ (indinfo[i].indrelname));
if (strcmp(indinfo[i].indproc, "0") == 0)
funcname = NULL;
@@ -2659,8 +2665,10 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
attname, indinfo[i].indexrelname);
exit_nicely(g_conn);
}
+ strcpy(id1, fmtId(attname));
+ strcpy(id2, fmtId(classname[k]));
sprintf(attlist + strlen(attlist), "%s%s %s",
- (k == 0) ? "" : ", ", fmtId(attname), fmtId(classname[k]));
+ (k == 0) ? "" : ", ", id1, id2);
free(classname[k]);
}
}
@@ -2668,10 +2676,12 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
if (!tablename || (!strcmp(indinfo[i].indrelname, tablename)))
{
+ strcpy(id1, fmtId(indinfo[i].indexrelname));
+ strcpy(id2, fmtId(indinfo[i].indrelname));
sprintf(q, "CREATE %s INDEX %s on %s using %s (",
(strcmp(indinfo[i].indisunique, "t") == 0) ? "UNIQUE" : "",
- fmtId(indinfo[i].indexrelname),
- fmtId(indinfo[i].indrelname),
+ id1,
+ id2,
indinfo[i].indamname);
if (funcname)
{