Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+1-2
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)