On 2019-Jan-13, Дилян Палаузов wrote:
> Hello,
Hello, please don't top-post.
> On Sun, 2019-01-13 at 10:08 -0500, Tom Lane wrote:
>
> > I remain of the opinion that (1) nobody has tested the proposed patch
> > across a range of readline and libedit versions, and (2) this would
> > probably be better addressed by a documentation addition anyway.
> > It's not psql's job to override user-settable readline options.
>
> when the user does not set anything, the presumption is, that the
> system has reasonable defaults. A reasonable default for
> “comment-begin” is “--”, and not the inherited default “#”.
I agree -- it doesn't make sense to treat the insert-comment command as
inserting a #, which is not a comment for psql. I use meta-# often in
bash and I'm never happy to have to resort to manually prepending "--"
in psql in order to make the current line a comment instead. The other
suggested changes in the original thread are of course much more
complicated and would require more research, but this one seems like a
slam-dunk improvement.
Now you may wish (as I once did) for the whole of the current input
buffer to become a comment instead, but it doesn't work that way in bash
either (only the current line; but then bash doesn't have multiline
comments AFAIK) and I don't think psql needs to do terribly much more
than that.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services