Re: Correct handling of blank/commented lines in PSQL interactive-mode history

Greg Nancarrow <gregn4422@gmail.com>

From: Greg Nancarrow <gregn4422@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Laurenz Albe <laurenz.albe@cybertec.at>, "David G. Johnston" <david.g.johnston@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-11-30T01:15:32Z
Lists: pgsql-hackers
On Tue, Nov 30, 2021 at 11:08 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Greg Nancarrow <gregn4422@gmail.com> writes:
> > (BTW, the patches are in Windows CRLF format, so on Linux at least I
> > needed to convert them using dos2unix so they'd apply using Git)
>
> Hmm.  Applying "od -c" to the copy of that message that's in my
> PG list folder shows clearly that there's no \r in it, nor do
> I see any when I save off the attachment.  I suppose this must
> be an artifact of the way that your MUA treats text attachments;
> or maybe the mail got mangled on its way to you.
>

Yeah, sorry, looks like it could be a Gmail issue for me.
When I alternatively downloaded your patches from the pgsql-hackers
archive, they're in Unix format, as you say.
After a bit of investigation, it seems that patch attachments (like
yours) with a Context-Type of "text/x-diff" download through Gmail in
CRLF format for me (I'm running a browser on Windows, but my Postgres
development environment is in a Linux VM). So those must get converted
from Unix to CRLF format if downloaded using a browser running on
Windows.
The majority of patch attachments (?) seem to have a Context-Type of
"application/octet-stream" or "text/x-patch", and these seem to
download raw (in their original Unix format).
I guess the attachment context-type is varying according to the mail
client used for posting.

Sorry for the noise.

Regards,
Greg Nancarrow
Fujitsu Australia



Commits

  1. psql: initialize comment-begin setting to a useful value by default.

  2. psql: treat "--" comments between queries as separate history entries.

  3. psql: include intra-query "--" comments in what's sent to the server.