[PATCHES] CREATEUSER == SUPERUSER?

2006-01-09 Thread Yoshiyuki Asaba
Hi,

The following command makes a superuser. Is this correct?

template1=# CREATE USER xyz CREATEUSER;
CREATE ROLE
template1=# select rolname,rolsuper from  pg_roles where rolname = 'xyz';
 rolname | rolsuper
-+--
 xyz | t
(1 row)

I think CREATEUSER keyword is equal to CREATEROLE.

Regards,
--
Yoshiyuki Asaba
[EMAIL PROTECTED]
Index: gram.y
===
RCS file: /projects/cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.521
diff -c -r2.521 gram.y
*** gram.y  29 Dec 2005 04:53:18 -  2.521
--- gram.y  9 Jan 2006 15:18:51 -
***
*** 664,675 
}
| CREATEUSER
{
!   /* For backwards compatibility, synonym 
for SUPERUSER */
!   $$ = makeDefElem(superuser, (Node 
*)makeInteger(TRUE));
}
| NOCREATEUSER
{
!   $$ = makeDefElem(superuser, (Node 
*)makeInteger(FALSE));
}
| LOGIN_P
{
--- 664,675 
}
| CREATEUSER
{
!   /* For backwards compatibility, synonym 
for CREATEROLE */
!   $$ = makeDefElem(createrole, (Node 
*)makeInteger(TRUE));
}
| NOCREATEUSER
{
!   $$ = makeDefElem(createrole, (Node 
*)makeInteger(FALSE));
}
| LOGIN_P
{

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [PATCHES] CREATEUSER == SUPERUSER?

2006-01-09 Thread Tom Lane
Yoshiyuki Asaba [EMAIL PROTECTED] writes:
 The following command makes a superuser. Is this correct?

 template1=# CREATE USER xyz CREATEUSER;

Yes, read the CREATE ROLE documentation:

CREATEUSER
NOCREATEUSER

 These clauses are an obsolete, but still accepted, spelling of
 SUPERUSER and NOSUPERUSER. Note that they are not equivalent to
 CREATEROLE as one might naively expect!


 I think CREATEUSER keyword is equal to CREATEROLE.

The proposed patch breaks backward compatibility, which is the only
reason we still allow these keywords at all.

regards, tom lane

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match