Re: psql and comments

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: Postgres Hackers List <hackers(at)postgresql(dot)org>
Subject: Re: psql and comments
Date: 1999-10-06 19:46:17
Message-ID: Pine.LNX.4.10.9910062138470.1744-100000@peter-e.yi.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Oct 6, Thomas Lockhart mentioned:

> 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->

That has been noted by me as well. From looking at the code I see that
someone intended to do something quite different in this case, like print
the comment on top of the query being echoed, I think. But I couldn't
really follow that.

Anyway, I'm going to end up rewriting that parser anyway, so that will be
taken care of. I was almost about to use flex but the Windows crowd
probably wouldn't find that too funny. (The Windows crowd won't find this
thing funny anyway, since I have no clue what #ifdef's I need for that.
Someone else will have to do a looong compile&fix session.)

The question I have though is, is there a reason, besides efficiency, that
psql doesn't just send the comment to the backend with the query? The
backend does accept comments last time I checked. Perhaps someone will one
day write something that makes some use of those comments on the backend
(thus conflicting with the very definition of "comment", but maybe a
logger) and it would remove some load out of psql.

--
Peter Eisentraut - peter_e(at)gmx(dot)net
http://yi.org/peter-e/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 1999-10-06 19:53:02 Re: [HACKERS] psql Week 1
Previous Message Bruce Momjian 1999-10-06 19:23:37 Re: [HACKERS] union and LIMIT problem