Re: [HACKERS] odd pg_dump output?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: t-ishii(at)sra(dot)co(dot)jp
Cc: t-ishii(at)sra(dot)co(dot)jp, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] odd pg_dump output?
Date: 1998-08-29 18:06:49
Message-ID: 199808291806.OAA10850@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Patch applied.

> >This appears to be fixed. Beta is September 1.
>
> 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(at)sra(dot)co(dot)jp
>
> *** pg_dump.c.orig Wed Aug 26 00:02:04 1998
> --- pg_dump.c Sat Aug 29 22:34:24 1998
> ***************
> *** 2435,2441 ****
> int i,
> j,
> k;
> ! char q[MAXQUERYLEN];
> char **parentRels; /* list of names of parent relations */
> int numParents;
> int actual_atts; /* number of attrs in this CREATE statment */
> --- 2435,2443 ----
> int i,
> j,
> k;
> ! 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,2516 ****
> }
> else
> {
> sprintf(q, "%s%s%s %s",
> q,
> (actual_atts > 0) ? ", " : "",
> ! fmtId(tblinfo[i].attnames[j]),
> ! fmtId(tblinfo[i].typnames[j]));
> actual_atts++;
> }
> if (tblinfo[i].adef_expr[j] != NULL)
> --- 2508,2520 ----
> }
> 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) ? ", " : "",
> ! id1,
> ! id2);
> actual_atts++;
> }
> if (tblinfo[i].adef_expr[j] != NULL)
> ***************
> *** 2572,2584 ****
> indclass;
> int nclass;
>
> ! char q[MAXQUERYLEN];
> PGresult *res;
>
> for (i = 0; i < numIndices; i++)
> {
> tableInd = findTableByName(tblinfo, numTables,
> ! fmtId(indinfo[i].indrelname));
>
> if (strcmp(indinfo[i].indproc, "0") == 0)
> funcname = NULL;
> --- 2576,2590 ----
> indclass;
> int nclass;
>
> ! char q[MAXQUERYLEN],
> ! id1[MAXQUERYLEN],
> ! id2[MAXQUERYLEN];
> PGresult *res;
>
> for (i = 0; i < numIndices; i++)
> {
> tableInd = findTableByName(tblinfo, numTables,
> ! (indinfo[i].indrelname));
>
> if (strcmp(indinfo[i].indproc, "0") == 0)
> funcname = NULL;
> ***************
> *** 2659,2666 ****
> attname, indinfo[i].indexrelname);
> exit_nicely(g_conn);
> }
> sprintf(attlist + strlen(attlist), "%s%s %s",
> ! (k == 0) ? "" : ", ", fmtId(attname), fmtId(classname[k]));
> free(classname[k]);
> }
> }
> --- 2665,2674 ----
> 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) ? "" : ", ", id1, id2);
> free(classname[k]);
> }
> }
> ***************
> *** 2668,2677 ****
> if (!tablename || (!strcmp(indinfo[i].indrelname, tablename)))
> {
>
> 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),
> indinfo[i].indamname);
> if (funcname)
> {
> --- 2676,2687 ----
> 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" : "",
> ! id1,
> ! id2,
> indinfo[i].indamname);
> if (funcname)
> {
>

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-08-29 18:09:07 Re: [DOCS] Re: [HACKERS] vacuum problem
Previous Message Bruce Momjian 1998-08-29 17:37:49 Re: [HACKERS] IP data type