Re: Backslash handling in strings - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Backslash handling in strings
Date
Msg-id 87sm04vxoc.fsf@stark.xeocode.com
Whole thread Raw
In response to Backslash handling in strings  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Backslash handling in strings
Re: Backslash handling in strings
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:

> The goal, at some point, is that we would have two types of strings, ''
> strings and E'' strings.  '' strings don't have any special backslash
> handling for compatibility with with the ANSI spec and all other
> databases except MySQL (and in MySQL it is now optional).  E'' strings
> behave just like our strings do now, with backslash handling.


The only thing I'm not clear on is what exactly is the use case for E''
strings. That is, who do you expect to actually use them?

Any new applications are recommended to be using '' strings. And any existing
applications obviously won't be using them since they don't currently exist.

The only potential candidates are existing applications being ported forward.
And that only makes sense if they're currently using some function like
addslash. Is it really easier to change all the SQL queries to use E'' (and
still have a bug) than it is to replace addslash with PQquoteString() ?



Also, I'm really confused why you would make PQescapeString require E''
strings and introduce a new function. That means existing non-buggy
applications would suddenly be buggy? And it would be impossible to write a
properly functioning application that interpolates a constant into a query
that would be portable to 8.2 and 8.0?


-- 
greg



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Consumer-grade vs enterprise-grade disk drives
Next
From: Bruce Momjian
Date:
Subject: Re: Consumer-grade vs enterprise-grade disk drives