Skip site navigation (1) Skip section navigation (2)

Cleanup for new escape handling

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Cleanup for new escape handling
Date: 2006-05-25 22:16:30
Message-ID: 200605252216.k4PMGU711096@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
This patch cleans up the use of E'' strings in 8.2.  8.2 is the first
release where standard_conforming_strings can be 'on', and when 'on',
escape_string_warning is disabled.

In 8.1, the behavior was to use E'' strings for any case where
backslashes exist.  For 8.2, per suggestion from Tom, we should use E''
strings only for standard_conforming_strings = 'off'.  This would allow
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 to pg_dump, like we do now for
client_encoding.  The only risk of the patch is that someone will use
one of the adt/ruleutils.c functions like pg_get_constraintdef() with
one setting of standard_conforming_strings and then try to load it into
a database with a different standard_conforming_strings setting.

I also added standard backslash handling for plpgsql.

I also checked ecpg and that uses E'' for all strings that have \
because it doesn't know if the target database is going to have
standard_conforming_strings on or off.  That seems best, and no one
expects the _output_ of ecpg to be portable.

The macros we use for escape processing really makes these changes easy.

-- 
  Bruce Momjian   http://candle.pha.pa.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Responses

pgsql-patches by date

Next:From: Chris BrowneDate: 2006-05-25 22:39:15
Subject: plpgsql documentation
Previous:From: Chris BrowneDate: 2006-05-25 21:07:25
Subject: AIX FAQ - IPv6 Fun

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group