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

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 14:32:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
Christopher Kings-Lynne wrote:
> > 	* 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.
> Why not compromise?  Allow ONLY \' in normal strings?  That'd deal with 
> the majority of compatibility issues.  Or, like you say, make it a GUC :(

The problem with allowing just \' is that we would then not be able to
distinguish a literal \ then ' from a \'.  Seems it is all or nothing.

FYI, I added a little to the web page:
	1. Change all \' to SQL-standard ''.
	2. Change use of \ in strings to use E''.
	3. Finally, change '' to treat \ literally.

  Bruce Momjian                        |
  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

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2005-06-16 15:08:33
Subject: Re: Autovacuum in the backend
Previous:From: Bruce MomjianDate: 2005-06-16 14:27:27
Subject: Re: Escape handling in strings

pgsql-patches by date

Next:From: Christof PetigDate: 2005-06-16 14:45:58
Subject: Re: libecpg (8.0 and CVS) hits a gcc bug on powerpc
Previous:From: Bruce MomjianDate: 2005-06-16 14:27:27
Subject: Re: Escape handling in strings

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