pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed[PATCH] Tiny CREATE STATISTICS tab-completion cleanup
3+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2018-11-27 d1ce4ed2d5 Use wildcard to match parens after CREATE STATISTICS
* [PATCH] Tiny CREATE STATISTICS tab-completion cleanup
@ 2018-11-26 16:49 Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
0 siblings, 1 reply; 3+ messages in thread
From: ilmari@ilmari.org @ 2018-11-26 16:49 UTC (permalink / raw)
To: pgsql-hackers
Hi Hackers,
As I was hacking on the CREATE TABLE tab completions, I noticed that the
CREATE STATISTICS completion was checking manually for the start and end
of the parenthesised list instead of using the "(*)" wildcard (because
it predates that functionality). Attached is a patch that updates it to
use the modern syntax.
- 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
Attachments:
0001-Use-wildcard-to-match-parens-after-CREATE-STATISTICS.patch (text/x-diff, 1.2K) download
From dc4940b937f3e3d51fb76bfa970aac15be9476d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Fri, 23 Nov 2018 15:21:22 +0000
Subject: [PATCH 1/2] Use wildcard to match parens after CREATE STATISTICS
Now that * can match in the middle of an alternative, we can use "(*)"
to match the whole parenthesised list, instead of checking manually
for the '(' and ')'.
---
src/bin/psql/tab-complete.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 9dbd555166..90cc1fe215 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -2390,9 +2390,7 @@ psql_completion(const char *text, int start, int end)
COMPLETE_WITH("(", "ON");
else if (Matches("CREATE", "STATISTICS", MatchAny, "("))
COMPLETE_WITH("ndistinct", "dependencies");
- else if (HeadMatches("CREATE", "STATISTICS", MatchAny) &&
- previous_words[0][0] == '(' &&
- previous_words[0][strlen(previous_words[0]) - 1] == ')')
+ else if (Matches("CREATE", "STATISTICS", MatchAny, "(*)"))
COMPLETE_WITH("ON");
else if (HeadMatches("CREATE", "STATISTICS", MatchAny) &&
TailMatches("FROM"))
--
2.19.2
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [PATCH] Tiny CREATE STATISTICS tab-completion cleanup
@ 2018-11-26 23:55 Tomas Vondra <tomas.vondra@2ndquadrant.com>
parent: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
0 siblings, 1 reply; 3+ messages in thread
From: Tomas Vondra @ 2018-11-26 23:55 UTC (permalink / raw)
To: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>; pgsql-hackers
Hi,
On 11/26/18 5:49 PM, Dagfinn Ilmari Mannsåker wrote:
> Hi Hackers,
>
> As I was hacking on the CREATE TABLE tab completions, I noticed that the
> CREATE STATISTICS completion was checking manually for the start and end
> of the parenthesised list instead of using the "(*)" wildcard (because
> it predates that functionality). Attached is a patch that updates it to
> use the modern syntax.
>
Makes sense. At first I was wondering why it was not modified by the
patch introducing the "(*)" wildcard, but I see 121213d9 only cared
about VACUUM, EXPLAIN and ANALYZE.
The patch seems fine to me, I'll get it committed.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [PATCH] Tiny CREATE STATISTICS tab-completion cleanup
@ 2018-11-28 00:01 Tomas Vondra <tomas.vondra@2ndquadrant.com>
parent: Tomas Vondra <tomas.vondra@2ndquadrant.com>
0 siblings, 0 replies; 3+ messages in thread
From: Tomas Vondra @ 2018-11-28 00:01 UTC (permalink / raw)
To: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>; pgsql-hackers
On 11/27/18 12:55 AM, Tomas Vondra wrote:
> Hi,
>
> On 11/26/18 5:49 PM, Dagfinn Ilmari Mannsåker wrote:
>> Hi Hackers,
>>
>> As I was hacking on the CREATE TABLE tab completions, I noticed that the
>> CREATE STATISTICS completion was checking manually for the start and end
>> of the parenthesised list instead of using the "(*)" wildcard (because
>> it predates that functionality). Attached is a patch that updates it to
>> use the modern syntax.
>>
>
> Makes sense. At first I was wondering why it was not modified by the
> patch introducing the "(*)" wildcard, but I see 121213d9 only cared
> about VACUUM, EXPLAIN and ANALYZE.
>
> The patch seems fine to me, I'll get it committed.
>
Pushed. Thanks for the patch.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2018-11-28 00:01 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-11-26 16:49 [PATCH] Tiny CREATE STATISTICS tab-completion cleanup Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
2018-11-26 23:55 ` Tomas Vondra <tomas.vondra@2ndquadrant.com>
2018-11-28 00:01 ` Tomas Vondra <tomas.vondra@2ndquadrant.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox