Duplicate code in psql's \ commands
Folks,
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.
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.
Objections?
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
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?
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.
regards, tom lane
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