pgsql: Fix pg_restore's direct-to-database mode for INSERT-style table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix pg_restore's direct-to-database mode for INSERT-style table
Дата
Msg-id E1RjEA9-0003NB-7J@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix pg_restore's direct-to-database mode for INSERT-style table data.

In commit 6545a901aaf84cb05212bb6a7674059908f527c3, I removed the mini SQL
lexer that was in pg_backup_db.c, thinking that it had no real purpose
beyond separating COPY data from SQL commands, which purpose had been
obsoleted by long-ago fixes in pg_dump's archive file format.
Unfortunately this was in error: that code was also used to identify
command boundaries in INSERT-style table data, which is run together as a
single string in the archive file for better compressibility.  As a result,
direct-to-database restores from archive files made with --inserts or
--column-inserts fail in our latest releases, as reported by Dick Visser.

To fix, restore the mini SQL lexer, but simplify it by adjusting the
calling logic so that it's only required to cope with INSERT-style table
data, not arbitrary SQL commands.  This allows us to not have to deal with
SQL comments, E'' strings, or dollar-quoted strings, none of which have
ever been emitted by dumpTableData_insert.

Also, fix the lexer to cope with standard-conforming strings, which was the
actual bug that the previous patch was meant to solve.

Back-patch to all supported branches.  The previous patch went back to 8.2,
which unfortunately means that the EOL release of 8.2 contains this bug,
but I don't think we're doing another 8.2 release just because of that.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/f3316a05b5ddee619ba0617716a4fef3ceb29ded

Modified Files
--------------
src/bin/pg_dump/pg_backup_archiver.c |   23 +++++---
src/bin/pg_dump/pg_backup_archiver.h |   25 +++++++++-
src/bin/pg_dump/pg_backup_db.c       |   90 +++++++++++++++++++++++++++++++++-
src/bin/pg_dump/pg_dump.c            |    8 +++
4 files changed, 135 insertions(+), 11 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix pg_restore's direct-to-database mode for INSERT-style table
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix pg_restore's direct-to-database mode for INSERT-style table