Re: PATCH: psql tab completion for SELECT
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Edmund Horner <ejrh00@gmail.com>
Cc: Vik Fearing <vik.fearing@2ndquadrant.com>,
Andres Freund <andres@anarazel.de>,
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
pgsql-hackers@lists.postgresql.org
Date: 2018-03-04T19:06:48Z
Lists: pgsql-hackers
Attachments
- version-dependent-tab-completion-1.patch (text/x-diff) patch
Edmund Horner <ejrh00@gmail.com> writes: > On 26 January 2018 at 13:44, Vik Fearing <vik.fearing@2ndquadrant.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
Commits
-
In psql, restore old behavior of Query_for_list_of_functions.
- b6e132ddc860 11.0 landed
-
Add infrastructure to support server-version-dependent tab completion.
- 722408bcd1bd 11.0 landed