Re: psql removes dashed comments

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Boris Zentner <bzm(at)2bz(dot)de>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql removes dashed comments
Date: 2022-04-07 18:48:15
Message-ID: CAKFQuwbGpukHtXqSXRZQ7zRB+trmsOQok-=Y7JU=ERhcex4ySQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday, April 7, 2022, Boris Zentner <bzm(at)2bz(dot)de> wrote:

> Hi,
>
> I was wondering why psql loose dashed comments and what can be done about
> this misbehaviour.
>
> # start psql, paste something run it, edit \e, rerun and so on. At the end
> all dashed comments are removed.
>
>
> psql -Xe postgres
> psql (14.1)
> Type "help" for help.
>
> postgres=# select 1, -- one
> 2, /* two */
> 3 -- three
> ;
> select 1,
> 2, /* two */
> 3
> ;
> ?column? | ?column? | ?column?
> ----------+----------+----------
> 1 | 2 | 3
> (1 row)
>
> postgres=# \e
> select 1,
> 2, /* two */
> 3
> ;
> ?column? | ?column? | ?column?
> ----------+----------+----------
> 1 | 2 | 3
> (1 row)
>
>
>
My last comment seems a bit off, but all you’ve done here is demonstrate
the documented behavior when the query buffer contains multiple commands
when \e is executed.

In either case this is working as documented and you really should be using
a permanent file for this kind of thing.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Boris Zentner 2022-04-07 19:22:22 Re: psql removes dashed comments
Previous Message David G. Johnston 2022-04-07 18:41:29 Re: psql removes dashed comments