git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 40b449a)
psql tab completion for CREATE DATABASE ... TEMPLATE ...
2016年9月11日 20:37:27 +0000 (15:37 -0500)
2016年9月11日 20:37:27 +0000 (15:37 -0500)
Sehrope Sarkuni, reviewed by Merlin Moncure & Vitaly Burovoy
with some editing by me


diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 019f75a37605b9c22e64e0ef05718948233d48bb..3e2f0846e79922e2f6b10bd729e87045167bb2ec 100644 (file)
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -599,8 +599,11 @@ static const SchemaQuery Query_for_list_of_matviews = {
" OR '\"' || nspname || '\"' ='%s') "
#define Query_for_list_of_template_databases \
-"SELECT pg_catalog.quote_ident(datname) FROM pg_catalog.pg_database "\
-" WHERE substring(pg_catalog.quote_ident(datname),1,%d)='%s' AND datistemplate"
+"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)"
#define Query_for_list_of_databases \
"SELECT pg_catalog.quote_ident(datname) FROM pg_catalog.pg_database "\
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /