Skip site navigation (1) Skip section navigation (2)

Re: [PATCH] Improve autocompletion for SELECT statements

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Wander Winkelhorst <w(dot)winkelhorst(at)gmail(dot)com>
Cc: pgadmin-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Improve autocompletion for SELECT statements
Date: 2011-11-13 22:06:00
Message-ID: 1321221960.2157.5.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: pgadmin-hackers
On Thu, 2011-11-10 at 22:51 +0100, Wander Winkelhorst wrote:
> 
> On Tue, Nov 1, 2011 at 4:31 PM, Guillaume Lelarge
> <guillaume(at)lelarge(dot)info> wrote:
>         
>         
>         
>         OK, it works now. I understand a lot of improvements could
>         come later,
>         but there is one thing that bugs me. And I think it should be
>         fixed
>         before applying.
>         
>         Let's say I wrote this:
>         
>         SELECT * FROM person JOIN company ON
>         
>         and try autocompletion afterwards. I get the list of columns
>         in person
>         and company, which is great. The issue is that you only have
>         the
>         column's name, not the table's name. So you don't know if the
>         column
>         refers to the first table or the second. We could say it's not
>         an issue
>         if we were sure they were all different. But if I have two
>         times the id
>         column, it gets kinda weird. Maybe you should show the table's
>         name in
>         front of the column's name.
>  
> Allright, another week, another patch :-)
> 
> 
> Changes since last time:
> - Support for aliasses (autocompletion on "select * from person p join
> company c on ...) will present a list of "p.id, p.name, c.id, c.name
> etc.)
> - Support for queries without aliasses (select * from person
> where ...) 
> - Support for queries without aliasses but with joins (select * from
> person join company on ...) 
> - Support for queries with mixed versions (select * from person p join
> company on ...)
> - Support for update statements (update person set ...)
> - Support for autocompletion after SELECT (select ... from person)
> - Fixed a crash
> 

Quite interesting, but alas I found two bugs:

1. select  from fbb_categories , fbb_posts
   I put my cursor between select and from, and ask for autocomplete,
   and I get

,.catname
,.disp_position
,.id

They all are part of fbb_categories. Unfortunately, that doesn't explain
the comma

* select  from fbb_categories, fbb_posts
  I put my cursor between select and from, and ask for autocomplete,
   and I get nothing (but it works with only one table).

* select * from fbb_topics c left join fbb_posts p on p.
  I put my cursor right after "p.". I was expecting to get the columns
  of fbb_posts, but got nothing.

* select * from fbb_topics c left join fbb_posts p on p
  I put my cursor right after "p". I was expecting to get the columns
  of fbb_posts, but got columns from p (as long as they contain a p
  themselves, and columns from c when they contain a p in their name.
  I was only expecting columns of fbb_posts.

Can you get a look at those? Thanks.


-- 
Guillaume
  http://blog.guillaume.lelarge.info
  http://www.dalibo.com


In response to

Responses

pgadmin-hackers by date

Next:From: Dave PageDate: 2011-11-13 22:10:47
Subject: Re: [PATCH] Improve autocompletion for SELECT statements
Previous:From: Dave PageDate: 2011-11-13 18:44:23
Subject: Re: v1.14 SQL editor collapsing feature

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group