Re: Duplicate code in psql's \ commands - Mailing list pgsql-hackers

From David Fetter
Subject Re: Duplicate code in psql's \ commands
Date
Msg-id 20090419182049.GT10700@fetter.org
Whole thread Raw
In response to Re: Duplicate code in psql's \ commands  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sun, Apr 19, 2009 at 02:09:48PM -0400, Tom Lane wrote:
> David Fetter <david@fetter.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@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Duplicate code in psql's \ commands
Next
From: Tom Lane
Date:
Subject: Sigh, MSVC build broken again