]> granicus.if.org Git - postgresql/commit
Fix pg_restore's direct-to-database mode for standard_conforming_strings.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 28 Jul 2011 18:07:04 +0000 (14:07 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 28 Jul 2011 18:07:04 +0000 (14:07 -0400)
commit4798aa5b09d8da9a221da4b91e92f1683174ad1e
tree412691c5da96e01fbafd28c2de72a357a09fa97c
parent42221b597eac30f06f1f49375538072985d3b59b
Fix pg_restore's direct-to-database mode for standard_conforming_strings.

pg_backup_db.c contained a mini SQL lexer with which it tried to identify
boundaries between SQL commands, but that code was not designed to cope
with standard_conforming_strings, and would get the wrong answer if a
backslash immediately precedes a closing single quote in such a string,
as per report from Julian Mehnle.  The bug only affects direct-to-database
restores from archive files made with standard_conforming_strings = on.

Rather than complicating the code some more to try to fix that, let's just
rip it all out.  The only reason it was needed was to cope with COPY data
embedded into ordinary archive entries, which was a layout that was used
only for about the first three weeks of the archive format's existence,
and never in any production release of pg_dump.  Instead, just rely on the
archive file layout to tell us whether we're printing COPY data or not.

This bug represents a data corruption hazard in all releases in which
standard_conforming_strings can be turned on, ie 8.2 and later, so
back-patch to all supported branches.
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_db.c
src/bin/pg_dump/pg_backup_db.h