psql-select-completion.patch
text/x-patch
Filename: psql-select-completion.patch
Type: text/x-patch
Part: 0
Message:
psql tab completion for SELECT
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/bin/psql/tab-complete.c | 3 | 1 |
diff --git i/src/bin/psql/tab-complete.c w/src/bin/psql/tab-complete.c
index 3854f7f..416aa2f 100644
--- i/src/bin/psql/tab-complete.c
+++ w/src/bin/psql/tab-complete.c
@@ -2555,7 +2555,9 @@ psql_completion(char *text, int start, int end)
COMPLETE_WITH_CONST("IS");
/* SELECT */
- /* naah . . . */
+ /* complete with columns and functions */
+ else if (pg_strcasecmp(prev_wd, "SELECT") == 0)
+ COMPLETE_WITH_QUERY("SELECT name FROM (SELECT attname FROM pg_attribute UNION SELECT proname || '(' FROM pg_proc) t (name) WHERE substring(name,1,%d)='%s'");
/* SET, RESET, SHOW */
/* Complete with a variable name */