pgsql: Fix COPY FROM for null marker strings that correspond to invalid

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix COPY FROM for null marker strings that correspond to invalid
Дата
Msg-id E1SC0Rd-00026l-16@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix COPY FROM for null marker strings that correspond to invalid encoding.

The COPY documentation says "COPY FROM matches the input against the null
string before removing backslashes".  It is therefore reasonable to presume
that null markers like E'\\0' will work ... and they did, until someone put
the tests in the wrong order during microoptimization-driven rewrites.
Since then, we've been failing if the null marker is something that would
de-escape to an invalidly-encoded string.  Since null markers generally
need to be something that can't appear in the data, this represents a
nontrivial loss of functionality; surprising nobody noticed it earlier.

Per report from Jeff Davis.  Backpatch to 8.4 where this got broken.

Branch
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/0e74f1f6e0313e768d62d5f252a7d167ebd46a86

Modified Files
--------------
src/backend/commands/copy.c         |   45 ++++++++++++++++++++++------------
src/test/regress/expected/copy2.out |   16 ++++++++++++
src/test/regress/sql/copy2.sql      |   15 +++++++++++
3 files changed, 60 insertions(+), 16 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Replace empty locale name with implied value in CREATE DATABASE
Следующее
От: Robert Haas
Дата:
Сообщение: pgsql: Code cleanup for heap_freeze_tuple.