diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-09-11 04:10:25 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-09-11 04:10:25 +0000 |
| commit | c7d1a8d428eb4270e3d51ecbf61b88bd96dc0f6a (patch) | |
| tree | b82b32b4ba8fe781428fee8d53597058a6e2aa89 /src/bin/pg_dump/pg_backup_archiver.h | |
| parent | e1a7d1b9f3d33344b2eb09d94db1a62a93b29b30 (diff) | |
| download | postgresql-c7d1a8d428eb4270e3d51ecbf61b88bd96dc0f6a.tar.gz | |
Fix some corner-case bugs in _sendSQLLine's parsing of SQL commands
> found in a pg_dump archive. It had problems with dollar-quote tags
broken across bufferload boundaries (this may explain bug report from
Rod Taylor), also with dollar-quote literals of the form $a$a$...,
and was also confused about the rules for backslash in double quoted
identifiers (ie, they're not special). Also put in placeholder support
for E'...' literals --- this will need more work later.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_archiver.h')
| -rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h index d9a09e3285..e7a05283d7 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -17,7 +17,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.66 2005/07/27 12:44:10 neilc Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.67 2005/09/11 04:10:25 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -136,22 +136,24 @@ typedef struct _outputContext typedef enum { - SQL_SCAN = 0, - SQL_IN_SQL_COMMENT, - SQL_IN_EXT_COMMENT, - SQL_IN_QUOTE, - SQL_IN_DOLLARTAG, - SQL_IN_DOLLARQUOTE + 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 { - int backSlash; - sqlparseState state; - char lastChar; - char quoteChar; - int braceDepth; - PQExpBuffer tagBuf; + 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 |
