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; } ;
/*****************************************************************************