Re: TABLE tab completion

Lists: pgsql-hackers
From: Magnus Hagander <magnus(at)hagander(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: TABLE tab completion
Date: 2011-09-24 10:59:06
Message-ID: CABUevExNgOv3iLr_UhXFFb3fhBq9E0ztKze8FwREWRPeDCyTww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

TABLE tab completion in psql only completes to tables, not views. but
the TABLE command works fine for both tables and views (and also
sequences).

Seems we should just complete it to relations and not tables - or can
anyone see a particular reason why we shouldn't?

Trivial patch attached.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Attachment Content-Type Size
table_complete.patch text/x-patch 659 bytes

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: TABLE tab completion
Date: 2011-09-25 13:06:47
Message-ID: CAEZATCXM=ymg81Lrxg-+GGhTrJuhVDecoZMbORn0frZTSi-+Uw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 24 September 2011 11:59, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> TABLE tab completion in psql only completes to tables, not views. but
> the TABLE command works fine for both tables and views (and also
> sequences).
>
> Seems we should just complete it to relations and not tables - or can
> anyone see a particular reason why we shouldn't?
>

Doesn't that mean that "DROP TABLE <tab>" would offer up views as well
as tables, which would be incorrect?

Regards,
Dean


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: TABLE tab completion
Date: 2011-09-26 08:37:50
Message-ID: CABUevEzvDP-YNA7ddrA3t_TH1MFpcutvCGmbNgsCBaX612WwVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Sep 25, 2011 at 15:06, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> On 24 September 2011 11:59, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>> TABLE tab completion in psql only completes to tables, not views. but
>> the TABLE command works fine for both tables and views (and also
>> sequences).
>>
>> Seems we should just complete it to relations and not tables - or can
>> anyone see a particular reason why we shouldn't?
>>
>
> Doesn't that mean that "DROP TABLE <tab>" would offer up views as well
> as tables, which would be incorrect?

Meh - you are correct, of course. I guess that's why we have code review :-)

So - not a oneliner, but how about something like this?

(Happy to have someone point out a neater way of doing it, not
entirely fluent in how we do the tab completion..)

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Attachment Content-Type Size
psql_table.patch text/x-patch 675 bytes

From: David Fetter <david(at)fetter(dot)org>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: TABLE tab completion
Date: 2011-09-26 12:29:46
Message-ID: 20110926122946.GA22441@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Sep 26, 2011 at 10:37:50AM +0200, Magnus Hagander wrote:
> On Sun, Sep 25, 2011 at 15:06, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> > On 24 September 2011 11:59, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> >> TABLE tab completion in psql only completes to tables, not views. but
> >> the TABLE command works fine for both tables and views (and also
> >> sequences).
> >>
> >> Seems we should just complete it to relations and not tables - or can
> >> anyone see a particular reason why we shouldn't?
> >>
> >
> > Doesn't that mean that "DROP TABLE <tab>" would offer up views as well
> > as tables, which would be incorrect?
>
> Meh - you are correct, of course. I guess that's why we have code review :-)
>
> So - not a oneliner, but how about something like this?
>
> (Happy to have someone point out a neater way of doing it, not
> entirely fluent in how we do the tab completion..)

That's pretty much it. Should it also (eventually) do SRFs?

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: TABLE tab completion
Date: 2011-10-24 11:25:05
Message-ID: CABUevEz1dMUpF7RdBHtikHkFAXAToTv+w9bHoDrezwcZayz1jw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Sep 26, 2011 at 10:37, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> On Sun, Sep 25, 2011 at 15:06, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
>> On 24 September 2011 11:59, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>>> TABLE tab completion in psql only completes to tables, not views. but
>>> the TABLE command works fine for both tables and views (and also
>>> sequences).
>>>
>>> Seems we should just complete it to relations and not tables - or can
>>> anyone see a particular reason why we shouldn't?
>>>
>>
>> Doesn't that mean that "DROP TABLE <tab>" would offer up views as well
>> as tables, which would be incorrect?
>
> Meh - you are correct, of course. I guess that's why we have code review :-)
>
> So - not a oneliner, but how about something like this?
>
> (Happy to have someone point out a neater way of doing it, not
> entirely fluent in how we do the tab completion..)

Rebased on top of the changes Tom made to the infrastructure, and applied.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/