Thread: [HACKERS] [PATCH] Add tab completion for DEALLOCATE
[HACKERS] [PATCH] Add tab completion for DEALLOCATE
From
ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Date:
Hi hackers, While playing with prepared statements in psql, I noticed that EXECUTE tab-completes the list of active prepared statements, but DEALLOCATE does not. Attached is a patch to fix this. Cheers, Ilmari -- "I use RMS as a guide in the same way that a boat captain would use a lighthouse. It's good to know where it is, but you generally don't want to find yourself in the same spot." - Tollef Fog Heen From ac727e99d6f06a82d6ba9a7927fed8ce179dac3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org> Date: Wed, 1 Feb 2017 17:39:43 +0000 Subject: [PATCH] Add tab completion for DEALLOCATE EXECUTE already tab-completes the list of prepared statements, but DEALLOCATE did not. --- src/bin/psql/tab-complete.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index d6fffcf42f..4a7bfe844a 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -2575,8 +2575,8 @@ psql_completion(const char *text, int start, int end) else if (Matches5("DROP", "RULE", MatchAny, "ON", MatchAny)) COMPLETE_WITH_LIST2("CASCADE", "RESTRICT"); -/* EXECUTE */ - else if (Matches1("EXECUTE")) +/* EXECUTE && DEALLOCATE */ + else if (Matches1("EXECUTE|DEALLOCATE")) COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements); /* EXPLAIN */ -- 2.11.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
ilmari@ilmari.org (Dagfinn Ilmari Mannsåker) writes: > While playing with prepared statements in psql, I noticed that EXECUTE > tab-completes the list of active prepared statements, but DEALLOCATE > does not. > Attached is a patch to fix this. Good idea, but I think it would be better to give DEALLOCATE its own entry in the list, so it could be placed in alphabetical order. regards, tom lane
Re: [HACKERS] [PATCH] Add tab completion for DEALLOCATE
From
ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Date:
Tom Lane <tgl@sss.pgh.pa.us> writes: > ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) writes: >> While playing with prepared statements in psql, I noticed that EXECUTE >> tab-completes the list of active prepared statements, but DEALLOCATE >> does not. >> Attached is a patch to fix this. > > Good idea, but I think it would be better to give DEALLOCATE its own > entry in the list, so it could be placed in alphabetical order. I was following the example from FETCH/MOVE further down to avoid duplicating the body of the stanza, but I guess in this case it's simple enough that it doesn't matter. Here's an updated patch wich adds it as a separate stanza. -- - Twitter seems more influential [than blogs] in the 'gets reported in the mainstream press' sense at least. - Matt McLeod - That'd be because the content of a tweet is easier to condense down to a mainstream media article. - Calle Dybedahl From 8b5e4ed63e558475b193b1d668ed14baae0c497c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org> Date: Thu, 2 Feb 2017 10:09:26 +0000 Subject: [PATCH] Add tab completion for DEALLOCATE EXECUTE already tab-completes the list of prepared statements, but DEALLOCATE was missing. --- src/bin/psql/tab-complete.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index d6fffcf42f..539ab1afe2 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -2453,6 +2453,10 @@ psql_completion(const char *text, int start, int end) else if (Matches5("CREATE", "EVENT", "TRIGGER", MatchAny, "ON")) COMPLETE_WITH_LIST3("ddl_command_start", "ddl_command_end", "sql_drop"); +/* DEALLOCATE */ + else if (Matches1("DEALLOCATE")) + COMPLETE_WITH_QUERY(Query_for_list_of_prepared_statements); + /* DECLARE */ else if (Matches2("DECLARE", MatchAny)) COMPLETE_WITH_LIST5("BINARY", "INSENSITIVE", "SCROLL", "NO SCROLL", -- 2.11.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] [PATCH] Add tab completion for DEALLOCATE
From
ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Date:
ilmari@ilmari.org (Dagfinn Ilmari Manns�ker) writes: > Here's an updated patch wich adds it as a separate stanza. I've added this to the current commit fest: https://commitfest.postgresql.org/13/1043/ -- "I use RMS as a guide in the same way that a boat captain would usea lighthouse. It's good to know where it is, but yougenerallydon't want to find yourself in the same spot." - Tollef Fog Heen
On 2/27/17 06:34, Dagfinn Ilmari Mannsåker wrote: > ilmari@ilmari.org (Dagfinn Ilmari Manns�ker) writes: > >> Here's an updated patch wich adds it as a separate stanza. > > I've added this to the current commit fest: > https://commitfest.postgresql.org/13/1043/ committed -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services