Re: [HACKERS] psql and comments - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] psql and comments
Date
Msg-id 199910071643.MAA02150@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] psql and comments  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
Responses Re: [HACKERS] psql and comments  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] psql and comments  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
> > > The following example shows psql correctly clearing its input buffer
> > > when a line containing *only* a comment is seen, but not completely
> > > clearing the buffer (or not realizing that it is cleared; note the
> > > changed prompt) if the comment is at the end of a valid query.
> > >
> > > postgres=> -- comment
> > > postgres=> select 'hi'; -- comment
> > > ?column?
> > > --------
> > > hi
> > > (1 row)
> > >
> > > postgres->
> > But aren't they _in_ a new statement, that begins with '--'?
> 
> ?? Sure, that's what psql thinks. But the first case shown above
> should also begin a new statement, changing the prompt (it doesn't,
> because after stripping the comment there are zero blanks in the
> line). I don't think that is the right behavior though.
> 
> Things aren't a big problem the way they stand, but istm that a
> completely blank line (after stripping single-line comments) may as
> well be the same as an empty line,and that psql could figure that out.

I see your point in the above example.  I will wait for the psql/libpq
cleaner-upper to finish, and take a look at it.

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


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Re: psql and comments