Re: psql tab completion for SELECT - Mailing list pgsql-hackers

From Greg Sabino Mullane
Subject Re: psql tab completion for SELECT
Date
Msg-id e557592e970cf869be73f78800e7bdfa@biglumber.com
Whole thread Raw
In response to Re: psql tab completion for SELECT  (Robert Haas <robertmhaas@gmail.com>)
List 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@turnstep.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-----




pgsql-hackers by date:

Previous
From: Jean-Baptiste Quenot
Date:
Subject: Fix PL/Python metadata when there is no result
Next
From: Peter Eisentraut
Date:
Subject: auto_explain produces invalid JSON