From 7a846ecc00b13a81adbf78b66dcf927077a802f8 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 26 May 2006 23:48:54 +0000 Subject: Use E'' strings internally only when standard_conforming_strings = 'off'. This allows pg_dump output with standard_conforming_strings = 'on' to generate proper strings that can be loaded into other databases without the backslash doubling we typically do. I have added the dumping of the standard_conforming_strings value to pg_dump. I also added standard backslash handling for plpgsql. --- src/include/c.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/include') diff --git a/src/include/c.h b/src/include/c.h index 32082809ec1..284367547ed 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.200 2006/04/14 03:38:56 tgl Exp $ + * $PostgreSQL: pgsql/src/include/c.h,v 1.201 2006/05/26 23:48:54 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -472,7 +472,14 @@ typedef NameData *Name; #define NameStr(name) ((name).data) -#define SQL_STR_DOUBLE(ch) ((ch) == '\'' || (ch) == '\\') +/* + * 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. + */ +#define SQL_STR_DOUBLE(ch, escape_backslash) \ + ((ch) == '\'' || ((escape_backslash) && (ch) == '\\')) + #define ESCAPE_STRING_SYNTAX 'E' /* ---------------------------------------------------------------- -- cgit v1.2.3