diff options
author | Kevin Grittner <kgrittn@postgresql.org> | 2016-09-12 09:22:57 -0500 |
---|---|---|
committer | Kevin Grittner <kgrittn@postgresql.org> | 2016-09-12 09:22:57 -0500 |
commit | 63c1a871940c7c4798788e98fdb1a24408a49d05 (patch) | |
tree | 4ea9306555158615f3c9325903f34698bbc503d8 /src | |
parent | 4068eb9918cbbeaba8042fa6fe0c1f5382f2f05f (diff) | |
download | postgresql-63c1a871940c7c4798788e98fdb1a24408a49d05.tar.gz postgresql-63c1a871940c7c4798788e98fdb1a24408a49d05.zip |
Fix recent commit for tab-completion of database template.
The details of commit 52803098ab26051c0c9802f3c19edffc90de8843 were
based on a misunderstanding of the role inheritance allowing use
of a database for a template. While the CREATEDB privilege is not
inherited, the database ownership is privileges are.
Pointed out by Vitaly Burovoy and Tom Lane.
Fix provided by Tom Lane, reviewed by Vitaly Burovoy.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/tab-complete.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 3e2f0846e79..50a45eb9289 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -601,9 +601,8 @@ static const SchemaQuery Query_for_list_of_matviews = { #define Query_for_list_of_template_databases \ "SELECT pg_catalog.quote_ident(d.datname) "\ " FROM pg_catalog.pg_database d "\ -" JOIN pg_catalog.pg_roles r ON r.rolname = CURRENT_USER "\ " WHERE substring(pg_catalog.quote_ident(d.datname),1,%d)='%s' "\ -" AND (d.datistemplate OR r.rolsuper OR d.datdba = r.oid)" +" AND (d.datistemplate OR pg_catalog.pg_has_role(d.datdba, 'USAGE'))" #define Query_for_list_of_databases \ "SELECT pg_catalog.quote_ident(datname) FROM pg_catalog.pg_database "\ |