Content-Length: 265594 | pFad | http://github.com/postgrespro/postgres/commit/52803098ab26051c0c9802f3c19edffc90de8843

9F psql tab completion for CREATE DATABASE ... TEMPLATE ... · postgrespro/postgres@5280309 · GitHub
Skip to content

Commit 5280309

Browse files
committed
psql tab completion for CREATE DATABASE ... TEMPLATE ...
Sehrope Sarkuni, reviewed by Merlin Moncure & Vitaly Burovoy with some editing by me
1 parent 40b449a commit 5280309

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/bin/psql/tab-complete.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,11 @@ static const SchemaQuery Query_for_list_of_matviews = {
599599
" OR '\"' || nspname || '\"' ='%s') "
600600

601601
#define Query_for_list_of_template_databases \
602-
"SELECT pg_catalog.quote_ident(datname) FROM pg_catalog.pg_database "\
603-
" WHERE substring(pg_catalog.quote_ident(datname),1,%d)='%s' AND datistemplate"
602+
"SELECT pg_catalog.quote_ident(d.datname) "\
603+
" FROM pg_catalog.pg_database d "\
604+
" JOIN pg_catalog.pg_roles r ON r.rolname = CURRENT_USER "\
605+
" WHERE substring(pg_catalog.quote_ident(d.datname),1,%d)='%s' "\
606+
" AND (d.datistemplate OR r.rolsuper OR d.datdba = r.oid)"
604607

605608
#define Query_for_list_of_databases \
606609
"SELECT pg_catalog.quote_ident(datname) FROM pg_catalog.pg_database "\

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/52803098ab26051c0c9802f3c19edffc90de8843

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy