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

From Adrian Klaver
Subject Re: PSQL/pgAdmin - Column Completion
Date
Msg-id 1420831875.2140035.211956377.6A76C1B0@webmail.messagingengine.com
Whole thread Raw
In response to Re: PSQL/pgAdmin - Column Completion  (dvlsg <dave@clubspeed.com>)
Responses Re: PSQL/pgAdmin - Column Completion
List pgsql-general
On Wed, Dec 31, 2014, at 12:01 PM, dvlsg wrote:
Yeah, I think that would be problematic. All other sql query applications I've used in the past with autocomplete seem to parse the entire query and find table references for autocompletion based on the whole query, whereas psql seems to typically base autocomplete off of the current cursor location and strings behind it without any lookaheads (as far as I can tell -- I only took a brief look, and it's been a long time since I've had to write C code).
 
I suppose what I would really be looking for is something like the vastly simplified query below, where pressing Ctrl+Space after each "a." would provide a list of columns only for the table alias.
 
SELECT
  a.Column1,
  a.Column2,
  a.Column3
FROM
  public.a_table_for_querying a
 
It looks like that would take a fairly significant bit of work/overhaul to make the autocomplete parser look at the entire query to find a list of used tables, and then find the list of available columns based on that, if I'm reading the code correctly.
 
I agree with that last sentiment, though -- I don't think a list of every column from every table would be very helpful. 
 
Just ran across pgcli which does you what you want from the command line:

https://github.com/amjith/pgcli
 
 
 
 
Dave Lesage
Club Speed, Inc.
Software Engineer
4740 Green River Road, Suite #308
Corona, CA 92880
 
24 Hour Support: (877) 751-3200
International Support: (951) 817-7073

This e-mail is covered by the Electronic Communications Privacy Act, 18 USC §§ 2510-2521 and is legally privileged. This communication and any accompanying document(s) are confidential and privileged. They are intended for the sole use of the addressee. If you receive this transmission in error, you are advised that any disclosure, copying, distribution, or the taking of any action in reliance upon the communication is strictly prohibited. If you have received this communication in error, please contact Club Speed, Inc. at (877) 751-3200.
 
 

View this message in context: Re: PSQL/pgAdmin - Column Completion
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
 
Attachment

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: GCC error while trying to install 9.4 via brew on MAC OS
Next
From: dvlsg
Date:
Subject: Re: PSQL/pgAdmin - Column Completion