Re: [HACKERS] psql and comments

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, Postgres Hackers List <hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] psql and comments
Date: 1999-10-07 14:57:31
Message-ID: Pine.LNX.4.10.9910071638570.848-100000@peter-e.yi.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Oct 6, Bruce Momjian mentioned:

> > postgres=> select 'hi'; -- comment

> But aren't they _in_ a new statement, that begins with '--'?

Good point. But it's still kind of counterintuitive, isn't it? Especially
since something that begins with a '--' can't ever become a useful
statement. The problem seems to be in the parsing stages: the query is
send off before the comment is encountered.

The alternative solution of putting query and comment on the same line
would be
=> select 'hi' -- comment ;
but that doesn't work at all obviously.

Meanwhile it might be worth pondering if
=> select 'hi' -- comment \g
should be allowed, since
=> select 'hi' \g -- comment
does something different. (And try removing that file if you're an
unexperienced user.)

Regarding that last line, I just discovered a possible incompatibility
between the official and my current version. The official version creates
a file "-- comment" whereas mine makes a file "--" because I now have word
splitting and quoting rules and the like (so \g '-- comment' would
work). Something to else ponder.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 1999-10-07 15:27:07 Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison
Previous Message Peter Mount 1999-10-07 14:50:25 RE: [HACKERS] Re: PostgreSQL Help