Re: [HACKERS] Updated TODO item - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [HACKERS] Updated TODO item
Date
Msg-id 200202250252.g1P2q4919000@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] Updated TODO item  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [HACKERS] Updated TODO item  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] Updated TODO item  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-patches
Bruce Momjian wrote:
> Tom Lane wrote:
> > Gavin Sherry <swm@linuxworld.com.au> writes:
> > > On Fri, 4 Jan 2002, Kaare Rasmussen wrote:
> > >> CREATE DATABASE dbname WITH OWNER = "user"
> >
> > > A much better idea. There is no conflict in using OWNER here.
> > > Revised patch attached.
> >
> > I have applied this patch, with a couple of editorial tweaks, and one
> > not-so-minor change: superuser privilege is required to create a
> > database on behalf of another user.  Seems to me that CREATEDB
> > privilege should not be sufficient to allow such an operation.
> >
> > Still to do: teach createdb script about it, and revise pg_dumpall
> > to use the facility instead of assuming that database owners have
> > CREATEDB privilege.  Working on those now ...
>
> Seems you are already on that too.  I will wait for you to finish, when
> there will be nothing left for me to do.  :-(

I have applied this minor patch.  I don't want to document the ability
to use equals in this case because some day we may remove it.  The
equals doesn't fit with any of our other WITH clauses.  I cleaned up a
paragraph on OWNER, and mentioned we may want to remove the equals
backward compatibility hack someday.

--
  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
Index: doc/src/sgml/ref/create_database.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/create_database.sgml,v
retrieving revision 1.24
diff -c -r1.24 create_database.sgml
*** doc/src/sgml/ref/create_database.sgml    24 Feb 2002 20:20:18 -0000    1.24
--- doc/src/sgml/ref/create_database.sgml    25 Feb 2002 02:48:15 -0000
***************
*** 24,33 ****
    </refsynopsisdivinfo>
    <synopsis>
  CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
!     [ WITH [ OWNER [ = ] <replaceable class="parameter">dbowner</replaceable> ]
!            [ LOCATION [ = ] '<replaceable class="parameter">dbpath</replaceable>' ]
!            [ TEMPLATE [ = ] <replaceable class="parameter">template</replaceable> ]
!            [ ENCODING [ = ] <replaceable class="parameter">encoding</replaceable> ] ]
    </synopsis>

    <refsect2 id="R2-SQL-CREATEDATABASE-1">
--- 24,33 ----
    </refsynopsisdivinfo>
    <synopsis>
  CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
!     [ WITH [ OWNER <replaceable class="parameter">dbowner</replaceable> ]
!            [ LOCATION '<replaceable class="parameter">dbpath</replaceable>' ]
!            [ TEMPLATE <replaceable class="parameter">template</replaceable> ]
!            [ ENCODING <replaceable class="parameter">encoding</replaceable> ] ]
    </synopsis>

    <refsect2 id="R2-SQL-CREATEDATABASE-1">
***************
*** 186,196 ****

    <para>
     Normally, the creator becomes the owner of the new database.
!    A different owner may be specified by using the <option>OWNER</>
!    clause (but only superusers may create databases on behalf of other users).
!    To create a database owned by oneself, either superuser privilege
!    or CREATEDB privilege is required.  A superuser may create a database
!    for another user, even if that user has no special privileges himself.
    </para>

    <para>
--- 186,195 ----

    <para>
     Normally, the creator becomes the owner of the new database.
!    Superusers can create databases owned by other users using the
!    <option>OWNER</> clause. They can even create databases owned by
!    users with no special privileges. Non-superusers with CREATEDB
!    privilege can only create databases owned by themselves.
    </para>

    <para>
Index: src/backend/parser/gram.y
===================================================================
RCS file: /cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.279
diff -c -r2.279 gram.y
*** src/backend/parser/gram.y    24 Feb 2002 20:20:20 -0000    2.279
--- src/backend/parser/gram.y    25 Feb 2002 02:48:26 -0000
***************
*** 3155,3160 ****
--- 3155,3164 ----
                  }
          ;

+ /*
+  *    Optional equals is here only for backward compatibility.
+  *    Should be removed someday.  bjm 2002-02-24
+  */
  opt_equal: '='                                { $$ = TRUE; }
          | /*EMPTY*/                            { $$ = FALSE; }
          ;

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Basic DOMAIN Support
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Updated TODO item