Re: [HACKERS] BIG grant problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Terry Mackintosh <terry(at)terrym(dot)com>
Cc: PostgreSQL-development <hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] BIG grant problem
Date: 1998-11-15 22:08:12
Message-ID: 23194.911167692@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Terry Mackintosh <terry(at)terrym(dot)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);
}
}

Browse pgsql-hackers by date

  From Date Subject
Next Message Steve Frampton 1998-11-15 23:04:10 Concurrency control questions 6.3.2 vs. 6.4
Previous Message Terry Mackintosh 1998-11-15 18:37:07 6.4.1 contrib/spi/