Re: [HACKERS] Extra functionality to createuser

2013-12-12 Thread Christopher Browne
On Wed, Dec 11, 2013 at 7:53 AM, Robert Haas wrote: > On Tue, Dec 10, 2013 at 9:55 AM, Amit Kapila wrote: >> On Tue, Dec 10, 2013 at 12:20 AM, Robert Haas wrote: >>> On Sat, Dec 7, 2013 at 11:39 PM, Amit Kapila >>> wrote: On Fri, Dec 6, 2013 at 10:31 AM, Peter Eisentraut wrote: > >>>

Re: [HACKERS] Extra functionality to createuser

2013-12-11 Thread Amit Kapila
On Wed, Dec 11, 2013 at 6:23 PM, Robert Haas wrote: > On Tue, Dec 10, 2013 at 9:55 AM, Amit Kapila wrote: >> Okay, the new way for syntax suggested by Peter has simplified the problem. >> Please find the updated patch and docs for multiple -g options. > > Committed. Thank you. With Regards, Ami

Re: [HACKERS] Extra functionality to createuser

2013-12-11 Thread Robert Haas
On Tue, Dec 10, 2013 at 9:55 AM, Amit Kapila wrote: > On Tue, Dec 10, 2013 at 12:20 AM, Robert Haas wrote: >> On Sat, Dec 7, 2013 at 11:39 PM, Amit Kapila wrote: >>> On Fri, Dec 6, 2013 at 10:31 AM, Peter Eisentraut wrote: How about only one role name per -g option, but allowing the -

Re: [HACKERS] Extra functionality to createuser

2013-12-10 Thread Amit Kapila
On Tue, Dec 10, 2013 at 12:20 AM, Robert Haas wrote: > On Sat, Dec 7, 2013 at 11:39 PM, Amit Kapila wrote: >> On Fri, Dec 6, 2013 at 10:31 AM, Peter Eisentraut wrote: >>> >>> How about only one role name per -g option, but allowing the -g option >>> to be repeated? >> >>I think that might si

Re: [HACKERS] Extra functionality to createuser

2013-12-09 Thread Robert Haas
On Sat, Dec 7, 2013 at 11:39 PM, Amit Kapila wrote: > On Fri, Dec 6, 2013 at 10:31 AM, Peter Eisentraut wrote: >> On Wed, 2013-11-20 at 11:23 -0500, Christopher Browne wrote: >>> I note that similar (with not quite identical behaviour) issues apply >>> to the user name. Perhaps the >>> resolutio

Re: [HACKERS] Extra functionality to createuser

2013-12-07 Thread Amit Kapila
On Fri, Dec 6, 2013 at 10:31 AM, Peter Eisentraut wrote: > On Wed, 2013-11-20 at 11:23 -0500, Christopher Browne wrote: >> I note that similar (with not quite identical behaviour) issues apply >> to the user name. Perhaps the >> resolution to this is to leave quoting issues to the administrator.

Re: [HACKERS] Extra functionality to createuser

2013-12-05 Thread Peter Eisentraut
On Wed, 2013-11-20 at 11:23 -0500, Christopher Browne wrote: > I note that similar (with not quite identical behaviour) issues apply > to the user name. Perhaps the > resolution to this is to leave quoting issues to the administrator. > That simplifies the problem away. How about only one role na

Re: [HACKERS] Extra functionality to createuser

2013-11-20 Thread Amit Kapila
On Wed, Nov 20, 2013 at 9:53 PM, Christopher Browne wrote: > Wait, that doesn't work if more than one role is added, as they get > merged together by the quoting. > > A somewhat ugly amount of quoting can be done at the shell level to > induce double quotes. > > $ createuser -g "\"test_rol'e_3\""

Re: [HACKERS] Extra functionality to createuser

2013-11-20 Thread Christopher Browne
Wait, that doesn't work if more than one role is added, as they get merged together by the quoting. A somewhat ugly amount of quoting can be done at the shell level to induce double quotes. $ createuser -g "\"test_rol'e_3\"" usequoted3 I note that similar (with not quite identical behaviour) iss

Re: [HACKERS] Extra functionality to createuser

2013-11-20 Thread Christopher Browne
On Tue, Nov 19, 2013 at 11:54 PM, Amit Kapila wrote: > On further tests, I found inconsistency in behavior when some special > characters are used in role names. > > 1. Test for role name containing quotes > a. In psql, create a role containing quotes in role name. >create role amitk in ro

Re: [HACKERS] Extra functionality to createuser

2013-11-19 Thread Amit Kapila
On Wed, Nov 20, 2013 at 2:05 AM, Christopher Browne wrote: > On Mon, Nov 18, 2013 at 1:01 AM, Amit Kapila wrote: >> On Sat, Nov 16, 2013 at 4:57 AM, Christopher Browne >> wrote: > > I picked the location of the 'g:' in the opt_long() call basically > arbitrarily; I think this is okay, the

Re: [HACKERS] Extra functionality to createuser

2013-11-19 Thread Peter Eisentraut
Patch needs to be rebased again. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Extra functionality to createuser

2013-11-19 Thread Christopher Browne
On Mon, Nov 18, 2013 at 1:01 AM, Amit Kapila wrote: > On Sat, Nov 16, 2013 at 4:57 AM, Christopher Browne > wrote: > Few comments: > > 1. > + -g > + --roles > > All other options which require argument are of form: > -c class="parameter">number > --connection-limit= class="para

Re: [HACKERS] Extra functionality to createuser

2013-11-17 Thread Amit Kapila
On Sat, Nov 16, 2013 at 4:57 AM, Christopher Browne wrote: > On Fri, Nov 15, 2013 at 3:14 PM, Peter Eisentraut wrote: >> On 11/14/13, 4:35 PM, Christopher Browne wrote:> On Thu, Nov 14, 2013 at >> 5:41 AM, Sameer Thakur wrote: So i think -g option is failing >>> >>> Right you are. >>> This

Re: [HACKERS] Extra functionality to createuser

2013-11-15 Thread Christopher Browne
On Fri, Nov 15, 2013 at 3:14 PM, Peter Eisentraut wrote: > On 11/14/13, 4:35 PM, Christopher Browne wrote:> On Thu, Nov 14, 2013 at > 5:41 AM, Sameer Thakur wrote: >>> So i think -g option is failing >> >> Right you are. >> >> I was missing a "g:" in the getopt_long() call. >> >> Attached is a re

Re: [HACKERS] Extra functionality to createuser

2013-11-15 Thread Peter Eisentraut
On 11/14/13, 4:35 PM, Christopher Browne wrote:> On Thu, Nov 14, 2013 at 5:41 AM, Sameer Thakur wrote: >> So i think -g option is failing > > Right you are. > > I was missing a "g:" in the getopt_long() call. > > Attached is a revised patch that handles that. > src/bin/scripts/createuser.c:117: i

Re: [HACKERS] Extra functionality to createuser

2013-11-14 Thread Christopher Browne
On Thu, Nov 14, 2013 at 5:41 AM, Sameer Thakur wrote: > So i think -g option is failing Right you are. I was missing a "g:" in the getopt_long() call. Attached is a revised patch that handles that. And it behaves better: postgres@cbbrowne ~/p/s/b/scripts> ./createuser -g purge_role -U postgres

Re: [HACKERS] Extra functionality to createuser

2013-11-14 Thread Sameer Thakur
> 1. cloned from https://github.com/samthakur74/postgres Sorry. cloned from https://github.com/postgres/postgres regards Sameer -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Extra functionality to createuser

2013-11-14 Thread Sameer Thakur
Hello, Tried to test this patch. Did the following 1. cloned from https://github.com/samthakur74/postgres 2. Applied patch and make install 3. created rolesapp_readonly_role,app2_writer_role 4. Tried createuser -D -S -l -g app_readonly_role,app2_writer_role test_user got error: createuser: invalid

Re: [HACKERS] Extra functionality to createuser

2013-09-27 Thread Christopher Browne
Attached is a patch implementing the "-g / --roles" option for createuser. I'll be attaching it to the open CommitFest shortly. createuser.diff Description: Binary data -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgr

Re: [HACKERS] Extra functionality to createuser

2013-09-27 Thread Jim Nasby
On 9/27/13 6:01 AM, Robert Haas wrote: Thus, the above commands might be replaced by: >PGUSER=postgres createuser -D -S -l -g >app_readonly_role,app2_writer_role my_new_user > >Would this be worth adding to the ToDo list? I'd be inclined to favor a patch implementing this. +1 -- Jim C. Nas

Re: [HACKERS] Extra functionality to createuser

2013-09-27 Thread Robert Haas
On Thu, Sep 26, 2013 at 1:04 PM, Christopher Browne wrote: > Sitting on my todo list for a while has been to consider the idea of > adding a bit of additional functionality to createuser. > > One of the functions of CREATE ROLE is to associate the role with > other roles, thus... > >create rol

[HACKERS] Extra functionality to createuser

2013-09-26 Thread Christopher Browne
Sitting on my todo list for a while has been to consider the idea of adding a bit of additional functionality to createuser. One of the functions of CREATE ROLE is to associate the role with other roles, thus... create role my_new_user nosuperuser nocreatedb login IN ROLE app_readonly_role