Re: [HACKERS] BIG grant problem
От | Tom Lane |
---|---|
Тема | Re: [HACKERS] BIG grant problem |
Дата | |
Msg-id | 23194.911167692@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: [HACKERS] BIG grant problem (Terry Mackintosh <terry@terrym.com>) |
Список | pgsql-hackers |
Terry Mackintosh <terry@terrym.com> writes: > Oh good, will there be a loose patch? so I and others don't have to > download the whole source again? If you need it here's the patch. (I already checked this into both 6.4 and 6.5 trees.) I found a second place that had the same problem, btw. Calling fmtID() twice in one expression is no good 'cuz it uses a static result area... regards, tom lane *** pg_dump.c.orig Fri Nov 6 10:56:42 1998 --- pg_dump.c Sun Nov 15 02:11:29 1998 *************** *** 2563,2577 **** { if (ACLlist[k].privledges != (char *) NULL) { if (ACLlist[k].user ==(char *) NULL) ! fprintf(fout, ! "GRANT %s on %s to PUBLIC;\n", ! ACLlist[k].privledges, fmtId(tbinfo.relname)); else ! fprintf(fout, ! "GRANT %s on %s to %s;\n", ! ACLlist[k].privledges, fmtId(tbinfo.relname), ! fmtId(ACLlist[k].user)); } } } --- 2563,2578 ---- { 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) ! fprintf(fout, "PUBLIC;\n"); else ! fprintf(fout, "%s;\n", fmtId(ACLlist[k].user)); } } } *************** *** 2851,2873 **** 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) { ! sprintf(q, "%s %s (%s) %s );\n", ! q, fmtId(funcname), attlist, fmtId(classname[0])); free(funcname); free(classname[0]); } else ! sprintf(q, "%s %s );\n", ! q, attlist); ! ! fputs(q, fout); } } --- 2852,2872 ---- strcpy(id1, fmtId(indinfo[i].indexrelname)); strcpy(id2, fmtId(indinfo[i].indrelname)); ! fprintf(fout, "CREATE %s INDEX %s on %s using %s (", (strcmp(indinfo[i].indisunique, "t") ==0) ? "UNIQUE" : "", id1, id2, indinfo[i].indamname); if (funcname) { ! /* need 2 printf's here cuz fmtId has static return area */ ! fprintf(fout, " %s", fmtId(funcname)); ! fprintf(fout, " (%s) %s );\n", attlist, fmtId(classname[0])); free(funcname); free(classname[0]); } else ! fprintf(fout, " %s );\n", attlist); } }
В списке pgsql-hackers по дате отправления: