summaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_backup_archiver.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-07-28 14:07:09 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2011-07-28 14:07:09 -0400
commit78e957dd46ce639559ff433a800fae47eb755cce (patch)
treedd0e20814abbfa2f2181b109801a295b5998af1e /src/bin/pg_dump/pg_backup_archiver.h
parentbc9d2e7c4ae1cb4f0392194f539ba3e6847f42f5 (diff)
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.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_archiver.h')
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.h27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h
index 9f826b678a1..a3a87dcd29b 100644
--- a/src/bin/pg_dump/pg_backup_archiver.h
+++ b/src/bin/pg_dump/pg_backup_archiver.h
@@ -139,28 +139,6 @@ typedef struct _outputContext
typedef enum
{
- SQL_SCAN = 0, /* normal */
- SQL_IN_SQL_COMMENT, /* -- comment */
- SQL_IN_EXT_COMMENT, /* slash-star comment */
- SQL_IN_SINGLE_QUOTE, /* '...' literal */
- SQL_IN_E_QUOTE, /* E'...' literal */
- SQL_IN_DOUBLE_QUOTE, /* "..." identifier */
- SQL_IN_DOLLAR_TAG, /* possible dollar-quote starting tag */
- SQL_IN_DOLLAR_QUOTE /* body of dollar quote */
-} sqlparseState;
-
-typedef struct
-{
- sqlparseState state; /* see above */
- char lastChar; /* preceding char, or '\0' initially */
- bool backSlash; /* next char is backslash quoted? */
- int braceDepth; /* parenthesis nesting depth */
- PQExpBuffer tagBuf; /* dollar quote tag (NULL if not created) */
- int minTagEndPos; /* first possible end position of $-quote */
-} sqlparseInfo;
-
-typedef enum
-{
STAGE_NONE = 0,
STAGE_INITIALIZING,
STAGE_PROCESSING,
@@ -194,9 +172,6 @@ typedef struct _archiveHandle
* Added V1.7 */
ArchiveFormat format; /* Archive format */
- sqlparseInfo sqlparse;
- PQExpBuffer sqlBuf;
-
time_t createDate; /* Date archive created */
/*
@@ -249,8 +224,6 @@ typedef struct _archiveHandle
* required */
bool writingCopyData; /* True when we are sending COPY data */
bool pgCopyIn; /* Currently in libpq 'COPY IN' mode. */
- PQExpBuffer pgCopyBuf; /* Left-over data from incomplete lines in
- * COPY IN */
int loFd; /* BLOB fd */
int writingBlob; /* Flag */