Skip to content

Commit 63c1a87

Browse files
committed
Fix recent commit for tab-completion of database template.
The details of commit 5280309 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.
1 parent 4068eb9 commit 63c1a87

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/bin/psql/tab-complete.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,8 @@ static const SchemaQuery Query_for_list_of_matviews = {
601601
#define Query_for_list_of_template_databases \
602602
"SELECT pg_catalog.quote_ident(d.datname) "\
603603
" FROM pg_catalog.pg_database d "\
604-
" JOIN pg_catalog.pg_roles r ON r.rolname = CURRENT_USER "\
605604
" WHERE substring(pg_catalog.quote_ident(d.datname),1,%d)='%s' "\
606-
" AND (d.datistemplate OR r.rolsuper OR d.datdba = r.oid)"
605+
" AND (d.datistemplate OR pg_catalog.pg_has_role(d.datdba, 'USAGE'))"
607606

608607
#define Query_for_list_of_databases \
609608
"SELECT pg_catalog.quote_ident(datname) FROM pg_catalog.pg_database "\

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy