Re: PATCH: psql tab completion for SELECT

2021-10-13 Thread Tom Lane
Edmund Horner writes: > On Fri, 8 Oct 2021 at 20:01, David Fetter wrote: >> What precisely is this supposed to do? > The main patch 0001 was to add completion for "SELECT " using > attributes, functions, and a couple of hard-coded options. This sort of thing has been proposed a few times, but n

Re: PATCH: psql tab completion for SELECT

2021-10-13 Thread Edmund Horner
On Fri, 8 Oct 2021 at 20:01, David Fetter wrote: > On Sat, Sep 22, 2018 at 06:53:55PM +1200, Edmund Horner wrote: > > Hi all, > > > > Here are some rebased versions of the last two patches. No changes in > > functionality, except a minor case sensitivity fix in the "completion > > after commas"

Re: PATCH: psql tab completion for SELECT

2021-10-08 Thread David Fetter
On Sat, Sep 22, 2018 at 06:53:55PM +1200, Edmund Horner wrote: > Hi all, > > Here are some rebased versions of the last two patches. No changes in > functionality, except a minor case sensitivity fix in the "completion > after commas" patch. > > Edmund I've rebased and updated these to be more

Re: PATCH: psql tab completion for SELECT

2018-09-21 Thread Edmund Horner
Hi all, Here are some rebased versions of the last two patches. No changes in functionality, except a minor case sensitivity fix in the "completion after commas" patch. Edmund 01-psql-select-tab-completion-v8.patch Description: Binary data 02-select-completion-after-commas.patch Description:

Re: PATCH: psql tab completion for SELECT

2018-07-16 Thread Edmund Horner
On 17 July 2018 at 03:27, Joao De Almeida Pereira wrote: > After playing alittle bit around with the patch I noticed that a comma was > missing in line 1214 > + 1202 /* min_server_version */ > + 1203 9, > + 1204 /* catname */ > + 1205

Re: PATCH: psql tab completion for SELECT

2018-07-16 Thread Edmund Horner
On 17 July 2018 at 00:00, Heikki Linnakangas wrote: > Playing around with this a little bit, I'm not very satisfied with the > completions. Sometimes this completes too much, and sometimes too little. > All of this has been mentioned in this and the other thread [1] already, > this just my opinion

Re: PATCH: psql tab completion for SELECT

2018-07-16 Thread Joao De Almeida Pereira
Hello, postgres=# select partkey, partc[TAB] > [no completions] > >From the thread, I believe that this feature will be implemented in a after patch. > > And I'd love this case, where go back to edit the SELECT list, after > already typing the FROM part, to be smarter: > > postgres=# select p[TA

Re: PATCH: psql tab completion for SELECT

2018-07-16 Thread Heikki Linnakangas
(trimmed CC list to evade gmail's spam filter, sorry) On 21/03/18 08:51, Edmund Horner wrote: Hi all, I haven't heard anything for a while and so assume you're beavering away on real features. :) I've been dogfooding this patch at work, and I am personally pretty happy with it. I still think t

Re: PATCH: psql tab completion for SELECT

2018-04-07 Thread Edmund Horner
On 6 April 2018 at 13:29, Peter Eisentraut wrote: > The selection of which functions to show can be further refined. > > I don't think the contents of pg_amproc and pg_cast should be excluded. > Some of those functions are useful. Similarly for pg_operator.oprcode. > > Things like oprrest and opr

Re: PATCH: psql tab completion for SELECT

2018-04-05 Thread Edmund Horner
On 6 April 2018 at 13:29, Peter Eisentraut wrote: > I looked at this a bit now. I think it still needs some work. Hi Peter, thanks for the feedback. > Some of the queries for older versions contain syntax errors that causes > them not to work. > > For example, in 80100: > > "'internal'::regtype

Re: PATCH: psql tab completion for SELECT

2018-04-05 Thread Peter Eisentraut
On 3/21/18 02:51, Edmund Horner wrote: > I still think the number of completions on an empty string is a bit > too big, but I don't know what to omit. There are around 1700 > completions on the empty "postgres" database in my testing, and we > show the first 1000 (arbitrarily limited, as the gener

Re: PATCH: psql tab completion for SELECT

2018-03-20 Thread Edmund Horner
On 8 March 2018 at 17:23, Edmund Horner wrote: > New patch that fixes a little bug with appending NULL addons to schema > queries. Hi all, I haven't heard anything for a while and so assume you're beavering away on real features. :) I've been dogfooding this patch at work, and I am personally p

Re: PATCH: psql tab completion for SELECT

2018-03-07 Thread Edmund Horner
Some updates on patch status: - "version-dependent-tab-completion-1.patch" by Tom Lane was committed in 722408bcd. - "psql-tab-completion-savepoint-v1.patch" by Edmund Horner is probably not needed. - "psql-select-tab-completion-v6.patch" (the latest) is still under development/review.

Re: PATCH: psql tab completion for SELECT

2018-03-07 Thread Edmund Horner
New patch that fixes a little bug with appending NULL addons to schema queries. psql-select-tab-completion-v6.patch Description: Binary data

Re: PATCH: psql tab completion for SELECT

2018-03-05 Thread Edmund Horner
I've reworked the SELECT completion patch to use the VersionedQuery infrastructure. I've also made it a schema query (for the functions), with an addon for the attributes. This provides schema-aware completion. Previously, addons to schema queries were appended verbatim; I've changed this to use

Re: PATCH: psql tab completion for SELECT

2018-03-05 Thread Tom Lane
I wrote: > 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

Re: PATCH: psql tab completion for SELECT

2018-03-05 Thread Vik Fearing
On 03/05/2018 11:21 AM, Edmund Horner wrote: > I am still just slightly unclear on where we are in relation to the > SAVEPOINT patch -- is that redundant now? My vote is to reject that patch. -- Vik Fearing +33 6 46 75 15 36 http://2ndQuadrant.fr Postg

Re: PATCH: psql tab completion for SELECT

2018-03-05 Thread Vik Fearing
On 03/05/2018 11:33 AM, Edmund Horner wrote: > On 5 March 2018 at 21:46, Vik Fearing wrote: >> Tab completion on functions in SELECT (a subset of this thread's patch) >> is quite important to me personally. I will work on this in the coming >> days. > > It's something I've missed numerous times

Re: PATCH: psql tab completion for SELECT

2018-03-05 Thread Tom Lane
"David G. Johnston" writes: > On Mon, Mar 5, 2018 at 7:41 AM, Tom Lane wrote: >> What would be actually useful is to be able to tab-complete even in >> the midst of a failed transaction block ... but savepoints as such >> won't get us there, and I have no good ideas about what would. > ​Why not

Re: PATCH: psql tab completion for SELECT

2018-03-05 Thread David G. Johnston
On Mon, Mar 5, 2018 at 7:41 AM, Tom Lane wrote: > What would be actually useful is to be able to tab-complete even in > the midst of a failed transaction block ... but savepoints as such > won't get us there, and I have no good ideas about what would. > ​Why not have psql open two sessions to th

Re: PATCH: psql tab completion for SELECT

2018-03-05 Thread Tom Lane
Edmund Horner writes: > On 5 March 2018 at 08:06, Tom Lane wrote: >> 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. > My patc

Re: PATCH: psql tab completion for SELECT

2018-03-05 Thread Edmund Horner
On 5 March 2018 at 21:46, Vik Fearing wrote: > Tab completion on functions in SELECT (a subset of this thread's patch) > is quite important to me personally. I will work on this in the coming > days. It's something I've missed numerous times in the last few months at work. I guess I should real

Re: PATCH: psql tab completion for SELECT

2018-03-05 Thread Edmund Horner
On 5 March 2018 at 08:06, Tom Lane wrote: > 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 ne

Re: PATCH: psql tab completion for SELECT

2018-03-05 Thread Vik Fearing
On 03/04/2018 08:06 PM, Tom Lane wrote: > Edmund Horner writes: >> On 26 January 2018 at 13:44, Vik Fearing 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 id

Re: PATCH: psql tab completion for SELECT

2018-03-04 Thread Tom Lane
Edmund Horner writes: > On 26 January 2018 at 13:44, Vik Fearing 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 worki

Re: PATCH: psql tab completion for SELECT

2018-01-25 Thread Edmund Horner
On 26 January 2018 at 13:44, Vik Fearing 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

Re: PATCH: psql tab completion for SELECT

2018-01-25 Thread Vik Fearing
On 01/26/2018 01:28 AM, Edmund Horner wrote: > On 19 January 2018 at 05:37, Vik Fearing wrote: >> On 01/18/2018 01:07 AM, Tom Lane wrote: >>> Edmund Horner writes: On 15 January 2018 at 15:45, Andres Freund wrote: > All worries like this are supposed to check the server version. >>> >>>

Re: PATCH: psql tab completion for SELECT

2018-01-25 Thread Edmund Horner
On 19 January 2018 at 05:37, Vik Fearing wrote: > On 01/18/2018 01:07 AM, Tom Lane wrote: >> Edmund Horner writes: >>> On 15 January 2018 at 15:45, Andres Freund wrote: All worries like this are supposed to check the server version. >> >>> In psql there are around 200 such tab completion qu

Re: PATCH: psql tab completion for SELECT

2018-01-25 Thread Edmund Horner
On 23 January 2018 at 21:47, Vik Fearing wrote: > Don't forget to include the list :-) > I'm quoting the entirety of the message---which I would normally trim---for > the archives. Thanks for spotting that. Sorry list! > If this were my patch, I'd have one query for 8.0, and then queries for al

Re: PATCH: psql tab completion for SELECT

2018-01-23 Thread Vik Fearing
On Tue, Jan 23, 2018 at 4:17 AM, Edmund Horner wrote: > Hi Vik, thanks for the feedback! > Don't forget to include the list :-) I'm quoting the entirety of the message---which I would normally trim---for the archives. > On 23 January 2018 at 07:41, Vik Fearing > wrote: > > This looks better.

Re: PATCH: psql tab completion for SELECT

2018-01-22 Thread Vik Fearing
On 01/12/2018 06:59 AM, Edmund Horner wrote: > Hi, here's a new patch. > > This one makes some changes to the criteria for which functions to > include; namely filtering out trigger functions and those that take or > return values of type "internal"; and including aggregate and window > functions.

Re: PATCH: psql tab completion for SELECT

2018-01-18 Thread Vik Fearing
On 01/12/2018 06:59 AM, Edmund Horner wrote: > Hi, here's a new patch. Thanks, and sorry for the delay. I have reviewed this patch, but haven't had time to put my thoughts together in a coherent message yet. I will be able to do that tomorrow. Thank you for your patience. -- Vik Fearing

Re: PATCH: psql tab completion for SELECT

2018-01-18 Thread Vik Fearing
On 01/18/2018 01:07 AM, Tom Lane wrote: > Edmund Horner writes: >> On 15 January 2018 at 15:45, Andres Freund wrote: >>> All worries like this are supposed to check the server version. > >> In psql there are around 200 such tab completion queries, none of >> which checks the server version. Man

Re: PATCH: psql tab completion for SELECT

2018-01-17 Thread Tom Lane
Edmund Horner writes: > On 15 January 2018 at 15:45, Andres Freund wrote: >> All worries like this are supposed to check the server version. > In psql there are around 200 such tab completion queries, none of > which checks the server version. Many would cause the user's > transaction to abort

Re: PATCH: psql tab completion for SELECT

2018-01-17 Thread Edmund Horner
On 15 January 2018 at 15:45, Andres Freund wrote: > On January 14, 2018 5:44:01 PM PST, Edmund Horner wrote: >>In psql if you have readline support and press TAB, psql will often >>run a DB query to get a list of possible completions to type on your >>current command line. >> >>It uses the curren

Re: PATCH: psql tab completion for SELECT

2018-01-14 Thread Andres Freund
On January 14, 2018 5:44:01 PM PST, Edmund Horner wrote: >On 15 January 2018 at 14:20, Andres Freund wrote: >> On January 14, 2018 5:12:37 PM PST, Edmund Horner >wrote: >>>And here's a patch to add savepoint protection for tab completion. >> >> It'd be good to explain what that means, so peopl

Re: PATCH: psql tab completion for SELECT

2018-01-14 Thread Edmund Horner
On 15 January 2018 at 14:20, Andres Freund wrote: > On January 14, 2018 5:12:37 PM PST, Edmund Horner wrote: >>And here's a patch to add savepoint protection for tab completion. > > It'd be good to explain what that means, so people don't have to read the > patch to be able to discuss whether th

Re: PATCH: psql tab completion for SELECT

2018-01-14 Thread Andres Freund
On January 14, 2018 5:12:37 PM PST, Edmund Horner wrote: >And here's a patch to add savepoint protection for tab completion. It'd be good to explain what that means, so people don't have to read the patch to be able to discuss whether this is a good idea. Andres -- Sent from my Android devic

Re: PATCH: psql tab completion for SELECT

2018-01-14 Thread Edmund Horner
And here's a patch to add savepoint protection for tab completion. It could definitely use some scrutiny to make sure it's not messing up the user's transaction. I added some error checking for the savepoint creation and the rollback, and then wrapped it in #ifdef NOT_USED (just as the query erro

Re: PATCH: psql tab completion for SELECT

2018-01-11 Thread Edmund Horner
Hi, here's a new patch. This one makes some changes to the criteria for which functions to include; namely filtering out trigger functions and those that take or return values of type "internal"; and including aggregate and window functions. Some of the other checks could be removed as they were

Re: [HACKERS] PATCH: psql tab completion for SELECT

2018-01-10 Thread Edmund Horner
On 11 January 2018 at 03:28, Vik Fearing wrote: > On 01/10/2018 06:38 AM, Edmund Horner wrote: >> Regarding support for older versions, psql fails silently if a tab >> completion query fails. > > No it doesn't, see below. > >> We could just let it do this, which is what >> happens with, for exampl

Re: [HACKERS] PATCH: psql tab completion for SELECT

2018-01-10 Thread Vik Fearing
On 01/10/2018 06:38 AM, Edmund Horner wrote: > Hi Vik, thanks so much for the comments and the offer to review! > > I kept a low profile after my first message as there was already a > commitfest in progress, but now I'm working on a V2 patch. > > I will include aggregate and window functions as

Re: [HACKERS] PATCH: psql tab completion for SELECT

2018-01-09 Thread Edmund Horner
Hi Vik, thanks so much for the comments and the offer to review! I kept a low profile after my first message as there was already a commitfest in progress, but now I'm working on a V2 patch. I will include aggregate and window functions as you suggest. And I'll exclude trigger functions. I'd li

Re: [HACKERS] PATCH: psql tab completion for SELECT

2018-01-09 Thread Vik Fearing
On 11/06/2017 05:28 AM, Edmund Horner wrote: > Hi pgsql-hackers, > > Here's a little draft patch to add *some* tab completion ability for > SELECT in psql. I have often missed the ability, especially with > invocations of utility functions. Yes, indeed! The vast majority of what I use interacti