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@gmx.net
http://yi.org/peter-e/