CREATEUSER == SUPERUSER?

Поиск
Список
Период
Сортировка
Искать

CREATEUSER == SUPERUSER?

От:
Yoshiyuki Asaba <y-asaba@sraoss.co.jp>
Дата:
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
y-asaba@sraoss.co.jp
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 -0000	2.521
--- gram.y	9 Jan 2006 15:18:51 -0000
***************
*** 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
  				{

Re: CREATEUSER == SUPERUSER?

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Yoshiyuki Asaba  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
FAQ