Re: PATCH: psql tab completion for SELECT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Edmund Horner <ejrh00(at)gmail(dot)com>
Cc: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: PATCH: psql tab completion for SELECT
Date: 2018-03-04 19:06:48
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Edmund Horner <ejrh00(at)gmail(dot)com> writes:
> On 26 January 2018 at 13:44, Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com> wrote:
>> On 01/26/2018 01:28 AM, Edmund Horner wrote:
>>> The patch mentioned attempts to put savepoints around the tab
>>> completion query where appropriate.

>> I am -1 on this idea.

> May I ask why? It doesn't stop psql working against older versions,
> as it checks that the server supports savepoints.

I looked into this patch and was disappointed to discover that it had
only a very ad-hoc solution to the problem of version-dependent tab
completion queries. We need something better --- in particular, the
recent prokind changes mean that there needs to be a way to make
SchemaQuery queries version-dependent.

So ... here is a modest proposal. It invents a VersionedQuery concept
and also extends the SchemaQuery infrastructure to allow those to be
versioned. I have not taken this nearly as far as it could be taken,
since it's mostly just proposing mechanism. To illustrate the
VersionedQuery infrastructure, I fixed it so it wouldn't send
publication/subscription queries to pre-v10 servers, and to illustrate
the versioned SchemaQuery infrastructure, I fixed the prokind problems.

If people like this approach, I propose to commit this more or less
as-is. The select-tab-completion patch would then need to be rewritten
to use this infrastructure, but I think that should be straightforward.
As a separate line of work, the infrastructure could be applied to fix
the pre-existing places where tab completion fails against old servers.
But that's probably work for v12 or beyond, unless somebody's really
motivated to do it right now.

regards, tom lane

Attachment Content-Type Size
version-dependent-tab-completion-1.patch text/x-diff 37.7 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-03-04 19:37:15 Re: [HACKERS] user-defined numeric data types triggering ERROR: unsupported type
Previous Message Tomas Vondra 2018-03-04 18:49:53 Re: [HACKERS] user-defined numeric data types triggering ERROR: unsupported type