vartabcomplete.diff
text/x-patch
Filename: vartabcomplete.diff
Type: text/x-patch
Part: 0
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: context
| File | + | − |
|---|---|---|
| src/bin/psql/tab-complete.c | 29 | 1 |
*** ./src/bin/psql/tab-complete.c.orig 2010-08-14 15:59:49.000000000 +0200
--- ./src/bin/psql/tab-complete.c 2010-10-04 10:51:31.401032421 +0200
***************
*** 2447,2453 ****
pg_strcasecmp(prev3_wd, "\\copy") != 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tsv, NULL);
-
/* Backslash commands */
/* TODO: \dc \dd \dl */
else if (strcmp(prev_wd, "\\connect") == 0 || strcmp(prev_wd, "\\c") == 0)
--- 2447,2452 ----
***************
*** 2517,2522 ****
--- 2516,2550 ----
COMPLETE_WITH_LIST(my_list);
}
+ else if (strcmp(prev_wd, "\\set") == 0)
+ {
+ const char **varnames;
+ int nvars = 0;
+ int size = 100;
+ struct _variable *ptr;
+
+ varnames = (const char **) pg_malloc((size + 1) * sizeof(char *));
+
+ /* fill array of varnames */
+ for (ptr = pset.vars->next; ptr; ptr = ptr->next)
+ {
+ if (nvars == size)
+ {
+ size = size + 100;
+ varnames = (const char **) realloc(varnames, (size + 1) * sizeof(char *));
+ if (!varnames)
+ {
+ psql_error("out of memory\n");
+ exit(EXIT_FAILURE);
+ }
+ }
+ varnames[nvars++] = ptr->name;
+ }
+ varnames[nvars] = NULL;
+ COMPLETE_WITH_LIST(varnames);
+
+ free(varnames);
+ }
else if (strcmp(prev_wd, "\\sf") == 0 || strcmp(prev_wd, "\\sf+") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_functions, NULL);
else if (strcmp(prev_wd, "\\cd") == 0 ||