Re: Duplicate code in psql's \ commands

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Duplicate code in psql's \ commands
Date: 2009-04-19 18:20:49
Message-ID: 20090419182049.GT10700@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Apr 19, 2009 at 02:09:48PM -0400, Tom Lane wrote:
> David Fetter <david(at)fetter(dot)org> writes:
> > While working on the new improved \df, I noticed a pretty major
> > infelicity, namely that \ commands get validated by two completely
> > independent code paths, namely tab-complete.c and
> > command.c/describe.c.
>
> Why is tab-complete doing anything that could be described as
> validation?

Using fixed-string comparisons--and this is already not quite right
for cases like \dvi--tab-complete can tell which command it's going to
complete. That's validation as far as it goes, but what it means is
that while \d [tab] works (kinda), things like \dS [tab] don't.

> > I'm thinking it would be a good idea to factor the validating out
> > as far as possible. This would also make it easier to make sure
> > that tab completion and \'s output match to the maximal reasonable
> > extent.
>
> I rather doubt that this will really be much of a win, but if you
> want to try it as a separate patch, go ahead.

OK :)

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

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-04-19 19:56:41 Sigh, MSVC build broken again
Previous Message Tom Lane 2009-04-19 18:09:48 Re: Duplicate code in psql's \ commands