Re: ecpg - GRANT bug

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, Michael Meskes <meskes(at)postgresql(dot)org>
Subject: Re: ecpg - GRANT bug
Date: 2001-10-16 13:55:59
Message-ID: 200110161355.f9GDtx712911@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

> Tom Lane writes:
> > Uh, isn't the correct fix
> > ! $$ = cat_str(8, make_str("grant"), $2, make_str("on"), $4, $5,
> > make_str("to"), $7, $8);
> > ISTM your patch loses the opt_with_grant clause. (Of course the
> > backend doesn't currently accept that clause anyway, but that's no
> > reason for ecpg to drop it.)
>
> My patch doesn't loose the option, it's never been passed on anyway:
>
> opt_with_grant: WITH GRANT OPTION
> {
> mmerror(ET_ERROR, "WITH GRANT OPTION is not supported. Only relation owners can set privileges");
> }
> | /*EMPTY*/
> ;
>
> The existing code in ecpg/preproc/preproc.y to handle the WITH option
> simply throws an error and aborts the processing... The patch below
> prevents the segfault and also passes on the WITH option to the
> backend, probably a better fix.
>
> Regards, Lee.
>
> Index: interfaces/ecpg/preproc/preproc.y
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/preproc/preproc.y,v
> retrieving revision 1.159
> diff -c -r1.159 preproc.y
> *** interfaces/ecpg/preproc/preproc.y 2001/10/14 12:07:57 1.159
> --- interfaces/ecpg/preproc/preproc.y 2001/10/15 09:06:29
> ***************
> *** 1693,1699 ****
>
> GrantStmt: GRANT privileges ON opt_table relation_name_list TO grantee_list opt_with_grant
> {
> ! $$ = cat_str(7, make_str("grant"), $2, make_str("on"), $4, $5, make_str("to"), $7);
> }
> ;
>
> --- 1693,1699 ----
>
> GrantStmt: GRANT privileges ON opt_table relation_name_list TO grantee_list opt_with_grant
> {
> ! $$ = cat_str(8, make_str("grant"), $2, make_str("on"), $4, $5, make_str("to"), $7, $8);
> }
> ;
>
> ***************
> *** 1769,1779 ****
> | grantee_list ',' grantee { $$ = cat_str(3, $1, make_str(","), $3); }
> ;
>
> ! opt_with_grant: WITH GRANT OPTION
> ! {
> ! mmerror(ET_ERROR, "WITH GRANT OPTION is not supported. Only relation owners can set privileges");
> ! }
> ! | /*EMPTY*/
> ;
>
>
> --- 1769,1776 ----
> | grantee_list ',' grantee { $$ = cat_str(3, $1, make_str(","), $3); }
> ;
>
> ! opt_with_grant: WITH GRANT OPTION { $$ = make_str("with grant option"); }
> ! | /*EMPTY*/ { $$ = EMPTY; }
> ;
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2001-10-16 13:56:31 Re: ecpg - GRANT bug
Previous Message John Summerfield 2001-10-16 12:32:29 Re: SQLCODE==-209

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-10-16 13:56:31 Re: ecpg - GRANT bug
Previous Message Bill Studenmund 2001-10-16 13:20:52 Re: Package support for Postgres