Re: psql tab completion for SELECT

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql tab completion for SELECT
Date: 2012-02-10 16:58:17
Message-ID: e557592e970cf869be73f78800e7bdfa@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Robert Haas wrote:

> One thing that's been bugging me for a while is that the tab
> completion code all works by looking backward up to n words. What we
> really want to know is what kind of statement we're in and where we
> are in it. Absent other information, if we're in the target list of a
> SELECT statement (nested arbitrarily) that behavior is reasonable. If
> we're someplace in a GRANT statement, or someplace in a CREATE
> STATEMENT where, say, a column name is expected, it's really not.

I played with this years ago, but readline does not really offer a
good way to easily get what we want (the whole statement, chunked into
nice bits to analyze). Of course at this point we should think about
making things more generic so we can drop in whatever readline-alternative
comes along in the future.

> Unfortunately, making the tab completion something other than
> incredibly stupid is likely to be an insane amount of work.

Insane amount of work? Check. Inredibly stupid? No, I think we've done
pretty good given the limitations we have. You want to see incredibly
stupid, see some of the *other* CLIs out there (hi, mysql! :)

- --
Greg Sabino Mullane greg(at)turnstep(dot)com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201202101157
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAk81TI4ACgkQvJuQZxSWSsivRQCfcze1WMq81rE+mtrOReHBQ6eV
SzEAn2JySDAoCokFkY/gtz//GqolVVm5
=d2LG
-----END PGP SIGNATURE-----

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2012-02-10 18:14:28 auto_explain produces invalid JSON
Previous Message Jean-Baptiste Quenot 2012-02-10 16:44:15 Fix PL/Python metadata when there is no result