Re: PSQL/pgAdmin - Column Completion

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dvlsg <dave(at)clubspeed(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PSQL/pgAdmin - Column Completion
Date: 2014-12-31 22:53:36
Message-ID: 2246.1420066416@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

dvlsg <dave(at)clubspeed(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message dvlsg 2014-12-31 23:12:09 Re: PSQL/pgAdmin - Column Completion
Previous Message dvlsg 2014-12-31 22:40:53 Re: PSQL/pgAdmin - Column Completion