pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gilles Darold <gilles.darold@dalibo.com>
To: pgsql-hackers@postgresql.org
Subject: Re: [patch] psql tab completion for ALTER DEFAULT PRIVILEGES
Date: Mon, 28 Nov 2016 09:16:31 +0100
Message-ID: <9905474c-ab29-bb66-408f-ca776fb3d69c@dalibo.com> (raw)
In-Reply-To: <1614593c-e356-5b27-6dba-66320a9bc68b@dalibo.com>
References: <1614593c-e356-5b27-6dba-66320a9bc68b@dalibo.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Le 20/11/2016 à 15:46, Gilles Darold a écrit :
> Hi,
>
> When tab-completing after ALTER DEFAULT PRIVILEGES ... GRANT|REVOKE,
> currently psql injects completion from the GRANT|REVOKE order, rather
> than the one expected.
>
> A patch is attached. It adds the right completion to GRANT|REVOKE after
> ALTER DEFAULT PRIVILEGES and after FOR ROLE|USER + IN SCHEMA.
>
> If there's no objection I will add it to next commit fest.
>
> Best regards,


Added to next commitfest. To explain more this patch, the completion of
SQL command:

    ALTER DEFAULT PRIVILEGES FOR ROLE xxx [tab]

propose:

    GRANT   REVOKE

and it should also propose IN SCHEMA. Same with ALTER DEFAULT PRIVILEGES
IN SCHEMA it should propose FOR ROLE. For example:

gilles=# ALTER DEFAULT PRIVILEGES IN SCHEMA public FOR ROLE user1 GRANT
ALL ON TABLES TO user2;
ALTER DEFAULT PRIVILEGES

is valid but current completion doesn't help.


The second issue addressed is the completion after GRANT|REVOKE, which
show completion for the GRANT|REVOKE command but the element are not the
same in the ALTER DEFAULT PRIVILEGES command.


I mean completion on command

    ALTER DEFAULT PRIVILEGES IN SCHEMA public FOR ROLE user1 GRANT ALL [tab]

propose the following keywords:

ALL FUNCTIONS IN SCHEMA
ALL SEQUENCES IN SCHEMA
DOMAIN
LANGUAGE
LARGE OBJECT
TABLE
TABLESPACE
ALL TABLES IN SCHEMA
FOREIGN DATA WRAPPER
FOREIGN SERVER
SCHEMA
FUNCTION
SEQUENCE
TYPE
DATABASE      

which is wrong. Keywords should only be

ON TABLES
ON SEQUENCES
ON FUNCTIONS
ON TYPES

This is what the patch is trying to fix.

-- 
Gilles Darold
Consultant PostgreSQL
http://dalibo.com - http://dalibo.org



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (5+ messages)  latest in thread

Message-ID: <9905474c-ab29-bb66-408f-ca776fb3d69c@dalibo.com>
Permalink:  ../9905474c-ab29-bb66-408f-ca776fb3d69c@dalibo.com/
Also on:    postgresql.org/message-id/9905474c-ab29-bb66-408f-ca776fb3d69c@dalibo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: gilles.darold@dalibo.com
  Subject: Re: [patch] psql tab completion for ALTER DEFAULT PRIVILEGES
  In-Reply-To: <9905474c-ab29-bb66-408f-ca776fb3d69c@dalibo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox