]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Use mode "r" for popen() in psql's evaluate_backtick().
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 28 Oct 2020 18:35:53 +0000 (14:35 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 28 Oct 2020 18:35:53 +0000 (14:35 -0400)
commit204d779695607eae5c6c0fa314516201b0af357f
tree86a6474c9f4af2130aa0a6911cf4cb570c2285f8
parentcc623ed2f4ac09a97c5ef24dee28d91482ae2e13
Use mode "r" for popen() in psql's evaluate_backtick().

In almost all other places, we use plain "r" or "w" mode in popen()
calls (the exceptions being for COPY data).  This one has been
overlooked (possibly because it's buried in a ".l" flex file?),
but it's using PG_BINARY_R.

Kensuke Okamura complained in bug #16688 that we fail to strip \r
when stripping the trailing newline from a backtick result string.
That's true enough, but we'd also fail to convert embedded \r\n
cleanly, which also seems undesirable.  Fixing the popen() mode
seems like the best way to deal with this.

It's been like this for a long time, so back-patch to all supported
branches.

Discussion: https://postgr.es/m/16688-c649c7b69cd7e6f8@postgresql.org
src/bin/psql/psqlscanslash.l