Re: Backslash problems with 8.1.4 - Mailing list pgsql-general

From Tom Lane
Subject Re: Backslash problems with 8.1.4
Date
Msg-id 3800.1149701186@sss.pgh.pa.us
Whole thread Raw
In response to Backslash problems with 8.1.4  (Matthew Schumacher <matt.s@aptalaska.net>)
Responses Re: Backslash problems with 8.1.4
List pgsql-general
Matthew Schumacher <matt.s@aptalaska.net> writes:
> I upgraded to postgres-8.1.4 and saw all of the backslash escape changes
> and understand why, but I can't figure out how to put a literal \' in
> the database.

You use the SQL-standard way, which is to repeat the quote mark:
    'Meet at Joe''s house'

> The data is coming from PHP,

I have met your problem, and its name is addslashes().  Don't use it.
addslashes is exactly the security hole we are trying to plug.

            regards, tom lane

pgsql-general by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: Import Data from MS SQL Server
Next
From: Matthew Schumacher
Date:
Subject: Re: Backslash problems with 8.1.4