Skip to content

Commit 752a4da

Browse files
committed
psql: tab completion for \encoding
Ian Barwick
1 parent 9243664 commit 752a4da

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/bin/psql/tab-complete.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000-2002 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.79 2003/06/11 22:13:22 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.80 2003/06/12 01:38:08 momjian Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -207,6 +207,11 @@ initialize_readline(void)
207207
" WHERE substr(nspname,1,%d)='%s' "\
208208
" HAVING COUNT(nspname)=1))"
209209

210+
#define Query_for_list_of_encodings \
211+
" SELECT DISTINCT pg_catalog.pg_encoding_to_char(conforencoding) "\
212+
" FROM pg_catalog.pg_conversion "\
213+
" WHERE substr(pg_catalog.pg_encoding_to_char(conforencoding),1,%d)=UPPER('%s')"
214+
210215
#define Query_for_list_of_functions \
211216
" SELECT DISTINCT proname || '()' "\
212217
" FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n "\
@@ -1273,6 +1278,8 @@ psql_completion(char *text, int start, int end)
12731278
COMPLETE_WITH_QUERY(Query_for_list_of_users);
12741279
else if (strcmp(prev_wd, "\\dv") == 0 || strcmp(prev_wd, "\\dv+") == 0)
12751280
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_views);
1281+
else if (strcmp(prev_wd, "\\encoding") == 0)
1282+
COMPLETE_WITH_QUERY(Query_for_list_of_encodings);
12761283
else if (strcmp(prev_wd, "\\h") == 0 || strcmp(prev_wd, "\\help") == 0)
12771284
COMPLETE_WITH_LIST(sql_commands);
12781285
else if (strcmp(prev_wd, "\\pset") == 0)

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