Re: Escape handling in strings

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Escape handling in strings
Date: 2005-06-16 03:12:07
Message-ID: 200506160312.j5G3C8i16903@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Christopher Kings-Lynne wrote:
> > Yep, you probably are. The hurt is backward compatibility, but the gain
> > is greater portability with other database systems.
>
> It's just going to break millions of PHP scripts :(

Let me give you a little longer answer. Right now we have this TODO
item:

* Allow backslash handling in quoted strings to be disabled for
portability

The use of C-style backslashes (.e.g. \n, \r) in quoted strings is not
SQL-spec compliant, so allow such handling to be disabled. However,
disabling backslashes could break many third-party applications and
tools.

Now, if we don't address it, we might as well remove the TODO item and
say we are never going to change it, because right now, we have a plan,
and I think the longer we go the harder it will be. And if we don't
change it, it makes it quite hard for people to port applications to
PostgreSQL. Fundamental queries like:

SELECT * FROM files WHERE filename = 'C:\tmp'

do not work. When a query with a single table and single WHERE clause
isn't portable, it seems like a problem. If this was isolated to CREATE
TABLE or something, it wouldn't be a big deal.

One possible idea is to have the warning in 8.1 configurable, so you can
turn it off, and see how well things go in the community. At a minimum,
the warning will flag non-portable queries to help in porting, and folks
can use E'' for non-porable string representations.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-06-16 03:13:58 Re: Escape handling in strings
Previous Message Christopher Kings-Lynne 2005-06-16 02:58:50 Re: Escape handling in strings

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-06-16 03:13:58 Re: Escape handling in strings
Previous Message Christopher Kings-Lynne 2005-06-16 02:58:50 Re: Escape handling in strings