Skip site navigation (1) Skip section navigation (2)

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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix pg_restore's direct-to-database mode for INSERT-styletable
Date: 2012-01-06 18:05:09
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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.



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 by date

Next:From: Tom LaneDate: 2012-01-06 18:31:53
Subject: pgsql: Fix typo, pg_types_date.h => pgtypes_date.h.
Previous:From: Andrew DunstanDate: 2012-01-06 16:13:40
Subject: Re: [COMMITTERS] pgsql: Fix breakage from earlier plperl fix.

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group