Re: WITH handling in CREATE USER, etc

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Vince Vielhaber <vev(at)michvhf(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: WITH handling in CREATE USER, etc
Date: 2002-06-17 16:46:53
Message-ID: 200206171646.g5HGkr613201@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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; }
;

/*****************************************************************************

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-06-17 16:54:49 Re: Can I adjust the oid counter for testing?
Previous Message Marek Mosiewicz 2002-06-17 15:29:44 Re: [HACKERS] Native OLE DB. What do you think about it