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

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-22 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 D

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
indexes on pg_attribute both start with attrelid; unless we know what small set of relations we want attributes for, I don't think we can avoid a SeqScan. Maybe there's a way to extract the attribute name part from the text entered and use it in a "WHERE attname LIKE '%s' " qualifier, to

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

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

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

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,

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

Re: PATCH: psql tab completion for SELECT

2018-03-21 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,

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
for completion. Edmund psql-select-tab-completion-v5.patch Description: Binary data

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

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

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

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

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

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

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

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

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

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

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

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

Re: PATCH: psql tab completion for SELECT

2018-01-25 Thread Edmund Horner
t like having so many different queries, so I am in favour of trimming it down. Can I leave that up to the committer to remove some cases or do we need another patch? > Great! Here's another. psql-select-tab-completion-v3.patch Description: Binary data

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

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 >

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

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

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

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

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 >

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

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

Re: PATCH: psql tab completion for SELECT

2018-01-11 Thread Edmund Horner
g the older releases was a bit much for a Friday evening. I'm not sure there's much value in support for old servers, as long as we can make completion queries fail a bit more gracefully. Edmund psql-select-tab-completion-v2.patch Description: Binary data

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

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