aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/quote.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2006-05-26 23:48:54 +0000
committerBruce Momjian <bruce@momjian.us>2006-05-26 23:48:54 +0000
commit7a846ecc00b13a81adbf78b66dcf927077a802f8 (patch)
tree78124ecf7f8ca7922f1412ad8638eac46396f136 /src/backend/utils/adt/quote.c
parent4d63e267742a2afe481a34f4742c0551c6b0a112 (diff)
downloadpostgresql-7a846ecc00b13a81adbf78b66dcf927077a802f8.tar.gz
postgresql-7a846ecc00b13a81adbf78b66dcf927077a802f8.zip
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.
Diffstat (limited to 'src/backend/utils/adt/quote.c')
-rw-r--r--src/backend/utils/adt/quote.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/backend/utils/adt/quote.c b/src/backend/utils/adt/quote.c
index 6d9cdeef8b5..31991ee51ed 100644
--- a/src/backend/utils/adt/quote.c
+++ b/src/backend/utils/adt/quote.c
@@ -7,13 +7,14 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/quote.c,v 1.18 2006/03/05 15:58:43 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/quote.c,v 1.19 2006/05/26 23:48:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "utils/builtins.h"
+#include "parser/gramparse.h"
/*
@@ -65,19 +66,20 @@ quote_literal(PG_FUNCTION_ARGS)
cp1 = VARDATA(t);
cp2 = VARDATA(result);
- for (; len-- > 0; cp1++)
- if (*cp1 == '\\')
- {
- *cp2++ = ESCAPE_STRING_SYNTAX;
- break;
- }
+ if (!standard_conforming_strings)
+ for (; len-- > 0; cp1++)
+ if (*cp1 == '\\')
+ {
+ *cp2++ = ESCAPE_STRING_SYNTAX;
+ break;
+ }
len = VARSIZE(t) - VARHDRSZ;
cp1 = VARDATA(t);
*cp2++ = '\'';
while (len-- > 0)
{
- if (SQL_STR_DOUBLE(*cp1))
+ if (SQL_STR_DOUBLE(*cp1, !standard_conforming_strings))
*cp2++ = *cp1;
*cp2++ = *cp1++;
}