Re: Backslash handling in strings

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Backslash handling in strings
Date: 2005-05-31 04:14:59
Message-ID: 87sm04vxoc.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-05-31 04:18:56 Re: Consumer-grade vs enterprise-grade disk drives
Previous Message Tom Lane 2005-05-31 04:07:42 Consumer-grade vs enterprise-grade disk drives

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-05-31 04:20:19 Re: Backslash handling in strings
Previous Message Alvaro Herrera 2005-05-31 03:48:27 Re: numeric precision when raising one numeric to another.