Re: Trailing semicolons in psql patch - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Trailing semicolons in psql patch
Date
Msg-id 200109300004.f8U04ZC09369@candle.pha.pa.us
Whole thread Raw
In response to Re: Trailing semicolons in psql patch  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Trailing semicolons in psql patch
List pgsql-patches
> greg@turnstep.com writes:
>
> > Since there is no reason to have a table named "mytable;"
> > why not just have psql do the smart thing and silently
> > strip the trailing semicolons?
>
> "Stripping" semicolons is one thing, accepting semicolons as command
> separators is another.  Your patch seems to handle the case of
>
> \d mytable;
>
> but it doesn't handle any of
>
> \d mytable; \d yourtable
> \d mytable;<space>
> \d mytable; select * from mytable;
>
> Anything short of that plus...
>
> > The attached patch only addresses
> > a few backslash commands as a proof of concept,
>
> ...is just going to create some other confusion in place of the current
> one.

My assumption is that the semicolons used with backslash commands are
just knee-jerk adding of semicolons to the end, not attempts to actually
string backslash commands togeter.   His patch does catch those cases.
The basic issue is that I think we can conclude that any trailing
semicolon on a line with a backslash command can be dropped.  In fact, I
wouldn't want to catch any of the items you listed above.  Let them fail.

We all do this by accident, don't we?  I know I do.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: More fixes for missing double quotes in the shell
Next
From: Tom Lane
Date:
Subject: Re: Trailing semicolons in psql patch