mirror of
https://github.com/postgres/postgres.git
synced 2025-05-17 06:41:24 +03:00
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.
This commit is contained in:
parent
4068eb9918
commit
63c1a87194
@ -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 "\
|
||||
|
Loading…
x
Reference in New Issue
Block a user