Re: PSQL/pgAdmin - Column Completion - Mailing list pgsql-general

From Tom Lane
Subject Re: PSQL/pgAdmin - Column Completion
Date
Msg-id 2246.1420066416@sss.pgh.pa.us
Whole thread Raw
In response to Re: PSQL/pgAdmin - Column Completion  (dvlsg <dave@clubspeed.com>)
Responses Re: PSQL/pgAdmin - Column Completion  (dvlsg <dave@clubspeed.com>)
List pgsql-general
dvlsg <dave@clubspeed.com> writes:
> The majority of my query writing is done in pgAdmin, not psql. I do tend to
> type out the from/where/join/whatever portion of the statement before
> finishing the select portion of the statement (starting with a SELECT * and
> replacing it once the rest of the query is in place). Fair enough, though --
> I am probably in the minority there.

Hm.  You're right that pgAdmin could be smarter than plain psql, since
it allows nonsequential typing of a command.  Whether this would be worth
pgAdmin having its own implementation of tab completion is something you'd
have to take up on the pgAdmin lists.

> However, what about a statement like this?

> SELECT *
> FROM public.TableA a
> WHERE a.Column1 > 50;

The big picture there is that psql's tab completion doesn't contain a full
blown parser but just looks at a couple of words of preceding context.
To be able to do anything with a nontrivial FROM clause would seem to
require adding a whole heck of a lot of machinery.  If you're sufficiently
excited about it to work on the project, feel free.  I've thought for some
time that tab-complete.c is overdue for being thrown away and rewritten
from scratch; but it would be a *lot* of work to make it significantly
better, and I doubt anybody is thinking about doing that.

            regards, tom lane


pgsql-general by date:

Previous
From: dvlsg
Date:
Subject: Re: PSQL/pgAdmin - Column Completion
Next
From: dvlsg
Date:
Subject: Re: PSQL/pgAdmin - Column Completion