Re: standard_conforming_strings and pg_escape_string()

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Conrad Lender <crlender(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: standard_conforming_strings and pg_escape_string()
Date: 2009-04-24 01:40:55
Message-ID: 1240537255.7028.6.camel@jd-laptop.pragmaticzealot.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2009-04-23 at 21:33 +0200, Conrad Lender wrote:
> Hi.

> I would like our database abstraction to be able to handle both settings
> for standard_conforming_strings transparently, i.e. perform the escaping
> according to the current DB server settings. Since pg_escape_string() is
> aware of the current database connection, I had expected its behavior to
> change accordingly:

> And finally, would it be safe to always use the E'\\' syntax, regardless
> of how standard_conforming_strings is set on the server?
>

You can set standard_conforming_strings on the fly (see SET). So why not
just make sure it is always on if going through your layer. That way
none of this is an issue.

Sincerely,

Joshua D. Drake

--
PostgreSQL - XMPP: jdrake(at)jabber(dot)postgresql(dot)org
Consulting, Development, Support, Training
503-667-4564 - http://www.commandprompt.com/
The PostgreSQL Company, serving since 1997

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chen, Dongdong (GE Healthcare) 2009-04-24 02:24:11 Re: need help for PostgreSQL consistency check mechanism
Previous Message Joshua D. Drake 2009-04-24 01:18:22 Re: need help for PostgreSQL consistency check mechanism