Fix a couple of bugs involving calling fmtID() twice in
a single printf() ... it'd work if fmtId() didn't use a static return area...
This commit is contained in:
parent
d85df9cae2
commit
0856cdf3f7
@ -21,7 +21,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.94 1998/11/06 15:54:47 thomas Exp $
|
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.95 1998/11/15 07:09:13 tgl Exp $
|
||||||
*
|
*
|
||||||
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
|
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
|
||||||
*
|
*
|
||||||
@ -2563,15 +2563,16 @@ dumpACL(FILE *fout, TableInfo tbinfo)
|
|||||||
{
|
{
|
||||||
if (ACLlist[k].privledges != (char *) NULL)
|
if (ACLlist[k].privledges != (char *) NULL)
|
||||||
{
|
{
|
||||||
|
/* If you change this code, bear in mind fmtId() can be
|
||||||
|
* used only once per printf() call...
|
||||||
|
*/
|
||||||
|
fprintf(fout,
|
||||||
|
"GRANT %s on %s to ",
|
||||||
|
ACLlist[k].privledges, fmtId(tbinfo.relname));
|
||||||
if (ACLlist[k].user == (char *) NULL)
|
if (ACLlist[k].user == (char *) NULL)
|
||||||
fprintf(fout,
|
fprintf(fout, "PUBLIC;\n");
|
||||||
"GRANT %s on %s to PUBLIC;\n",
|
|
||||||
ACLlist[k].privledges, fmtId(tbinfo.relname));
|
|
||||||
else
|
else
|
||||||
fprintf(fout,
|
fprintf(fout, "%s;\n", fmtId(ACLlist[k].user));
|
||||||
"GRANT %s on %s to %s;\n",
|
|
||||||
ACLlist[k].privledges, fmtId(tbinfo.relname),
|
|
||||||
fmtId(ACLlist[k].user));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2851,23 +2852,21 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
|
|||||||
|
|
||||||
strcpy(id1, fmtId(indinfo[i].indexrelname));
|
strcpy(id1, fmtId(indinfo[i].indexrelname));
|
||||||
strcpy(id2, fmtId(indinfo[i].indrelname));
|
strcpy(id2, fmtId(indinfo[i].indrelname));
|
||||||
sprintf(q, "CREATE %s INDEX %s on %s using %s (",
|
fprintf(fout, "CREATE %s INDEX %s on %s using %s (",
|
||||||
(strcmp(indinfo[i].indisunique, "t") == 0) ? "UNIQUE" : "",
|
(strcmp(indinfo[i].indisunique, "t") == 0) ? "UNIQUE" : "",
|
||||||
id1,
|
id1,
|
||||||
id2,
|
id2,
|
||||||
indinfo[i].indamname);
|
indinfo[i].indamname);
|
||||||
if (funcname)
|
if (funcname)
|
||||||
{
|
{
|
||||||
sprintf(q, "%s %s (%s) %s );\n",
|
/* need 2 printf's here cuz fmtId has static return area */
|
||||||
q, fmtId(funcname), attlist, fmtId(classname[0]));
|
fprintf(fout, " %s", fmtId(funcname));
|
||||||
|
fprintf(fout, " (%s) %s );\n", attlist, fmtId(classname[0]));
|
||||||
free(funcname);
|
free(funcname);
|
||||||
free(classname[0]);
|
free(classname[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sprintf(q, "%s %s );\n",
|
fprintf(fout, " %s );\n", attlist);
|
||||||
q, attlist);
|
|
||||||
|
|
||||||
fputs(q, fout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user