Re: BUG #16688: psql removes only LF without CR at end of backquotes on windows.
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: kensuke.okamura@kantei.co.jp
Cc: pgsql-bugs@lists.postgresql.org, Bruce Momjian <bruce@momjian.us>
Date: 2020-10-28T03:27:05Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> psql removes only LF without CR at end of backquotes on windows.
Hmm, seems like b654714f9 missed this. psqlscanslash.l has
fd = popen(cmd, PG_BINARY_R);
...
/* strip any trailing newline */
if (cmd_output.len > 0 &&
cmd_output.data[cmd_output.len - 1] == '\n')
cmd_output.len--;
But rather than mess with that newline-chomping code, I'm
inclined to wonder why we're using PG_BINARY_R for input
that we clearly expect to be textual. Most of our other
popen's do not do that.
Bruce, this seems to date to 98e9775a3 ... don't suppose
you remember that? I see the point about control-Z in text
files, but I wonder how plausible that is for popen cases.
regards, tom lane
Commits
-
Use mode "r" for popen() in psql's evaluate_backtick().
- cb0982ba9796 12.5 landed
- ba4f5413e357 13.1 landed
- aff06436caf8 9.5.24 landed
- 9eb2503391da 11.10 landed
- 66f8687a8ff8 14.0 landed
- 504f963f76f0 10.15 landed
- 204d77969560 9.6.20 landed