Neil Conway writes:
> Well, I won't pretend to understand the psql command parsing code (hand
> parsing w/o flex: yuck!) -- but it seems to me that when it returns the
> "invalid command" error, it should reset the environment: the previous
> command failed, so the user should get an error and a chance to enter a
> new command.
The backslash commands are separate from the SQL commands. The reason is
that the backslash commands may actually operate on the buffer where the
SQL commands are being entered.
For instance, say I start entering a command and then decide not to do it
and reset the buffer.
delete from table1
Instead of \r I entered \R, as a typo. There is no \R command, so what do
1. What you proposed: Execute the command as is and reset the buffer. --
I think not.
2. Clear the buffer. This might be reasonable, but I find it totally
unnecessary. Maybe I wanted to type \p or \e because my buffer is
already 23 lines long.
3. Ignore the failed backslash command and keep going. This is what it's
Think of psql as an editor and (some of) the backslash commands as editor
commands. When you enter a wrong command in your editor, what does it do?
Peter Eisentraut peter_e(at)gmx(dot)net
In response to
pgsql-patches by date
|Next:||From: Neil Conway||Date: 2002-03-11 23:41:08|
|Subject: Re: psql: backslash fix|
|Previous:||From: Bruce Momjian||Date: 2002-03-11 22:58:12|
|Subject: Re: support for POSIX 1003.1-2001 hosts|