Re: WITH handling in CREATE USER, etc - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: WITH handling in CREATE USER, etc
Date
Msg-id 200206171646.g5HGkr613201@candle.pha.pa.us
Whole thread Raw
In response to Re: WITH handling in CREATE USER, etc  (Vince Vielhaber <vev@michvhf.com>)
Responses Re: WITH handling in CREATE USER, etc  (Vince Vielhaber <vev@michvhf.com>)
List pgsql-hackers
Vince Vielhaber wrote:
> On Mon, 17 Jun 2002, Bruce Momjian wrote:
> 
> > I noticed that gram.y doesn't handle with optional WITH in CREATE USER,
> > ALTER USER, CREATE GROUP very well.  It duplicates the actions, rather
> > than creating an optional WITH clause.
> 
> Care to elaborate?

Sure, here is a sample where there were two rules that were merged into
one with opt_with:

Index: gram.y
===================================================================
RCS file: /cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.323
retrieving revision 2.324
diff -c -r2.323 -r2.324
*** gram.y    15 Jun 2002 03:00:03 -0000    2.323
--- gram.y    17 Jun 2002 05:40:32 -0000    2.324
***************
*** 518,537 ****  *  *****************************************************************************/ 
! CreateUserStmt:  CREATE USER UserId OptUserList 
!                 {
!                     CreateUserStmt *n = makeNode(CreateUserStmt);
!                     n->user = $3;
!                     n->options = $4;
!                     $$ = (Node *)n;
!                 }
!             | CREATE USER UserId WITH OptUserList                 {                     CreateUserStmt *n =
makeNode(CreateUserStmt);                    n->user = $3;                     n->options = $5;                     $$
=(Node *)n;
 
!                 }                            ;
/*****************************************************************************
--- 518,535 ----  *  *****************************************************************************/ 
! CreateUserStmt:  CREATE USER UserId opt_with OptUserList                 {                     CreateUserStmt *n =
makeNode(CreateUserStmt);                    n->user = $3;                     n->options = $5;                     $$
=(Node *)n;
 
!                 }
!         ;
! 
! 
! opt_with:    WITH                                { $$ = TRUE; }
!         | /*EMPTY*/                                { $$ = TRUE; }         ;
/*****************************************************************************



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Massive regression failures
Next
From: Bruce Momjian
Date:
Subject: Re: Can I adjust the oid counter for testing?