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.

I have fixed this, and made WITH in CREATE DATABASE optional for
constency.

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

Mon, 17 Jun 2002 01:41:34 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
WITH handling in CREATE USER, etc
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?

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.com    http://www.pop4.net
         56K Nationwide Dialup from $16.00/mo at Pop4 Networking
        Online Campground Directory    http://www.camping-usa.com
       Online Giftshop Superstore    http://www.cloudninegifts.com
==========================================================================




Mon, 17 Jun 2002 06:23:35 -0400 (EDT)
Vince Vielhaber <vev@michvhf.com>
Re: WITH handling in CREATE USER, etc
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; }
  		;
  
  /*****************************************************************************


Mon, 17 Jun 2002 12:46:53 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: WITH handling in CREATE USER, etc
On Mon, 17 Jun 2002, Bruce Momjian wrote:

> 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:

That makes sense.

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.com    http://www.pop4.net
         56K Nationwide Dialup from $16.00/mo at Pop4 Networking
        Online Campground Directory    http://www.camping-usa.com
       Online Giftshop Superstore    http://www.cloudninegifts.com
==========================================================================




Mon, 17 Jun 2002 12:55:17 -0400 (EDT)
Vince Vielhaber <vev@michvhf.com>
Re: WITH handling in CREATE USER, etc