diff options
| author | Tom Lane | 2006-05-28 21:13:54 +0000 |
|---|---|---|
| committer | Tom Lane | 2006-05-28 21:13:54 +0000 |
| commit | 134b463f027d1113df6f983c3348f165b1ac1ffa (patch) | |
| tree | 7e247256f1fcb5e0e1a4759b854f673366c4478d /src/include | |
| parent | 117d73a9e7af61f6742e3d2b46f1dfbe3e02b9ca (diff) | |
Fix up pg_dump to do string escaping fully correctly for client encoding
and standard_conforming_strings; likewise for the other client programs
that need it. As per previous discussion, a pg_dump dump now conforms
to the standard_conforming_strings setting of the source database.
We don't use E'' syntax in the dump, thereby improving portability of
the SQL. I added a SET escape_strings_warning = off command to keep
the dumps from getting a lot of back-chatter from that.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/c.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/include/c.h b/src/include/c.h index 284367547ed..679981ea6cd 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/c.h,v 1.201 2006/05/26 23:48:54 momjian Exp $ + * $PostgreSQL: pgsql/src/include/c.h,v 1.202 2006/05/28 21:13:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -473,12 +473,13 @@ typedef NameData *Name; #define NameStr(name) ((name).data) /* - * In 8.2, we are warning for \ in a non-E string if std_strings are off. - * For this reason, we use E for \ strings, unless standard_conforming_strings - * is on. + * Support macros for escaping strings. escape_backslash should be TRUE + * if generating a non-standard-conforming string. Prefixing a string + * with ESCAPE_STRING_SYNTAX guarantees it is non-standard-conforming. + * Beware of multiple evaluation of the "ch" argument! */ #define SQL_STR_DOUBLE(ch, escape_backslash) \ - ((ch) == '\'' || ((escape_backslash) && (ch) == '\\')) + ((ch) == '\'' || ((ch) == '\\' && (escape_backslash))) #define ESCAPE_STRING_SYNTAX 'E' |
