Re: Escaping \n

From: Terry Lee Tucker <terry(at)chosen-ones(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Escaping \n
Date: 2008-03-28 21:29:06
Message-ID: 200803281729.07032.terry@chosen-ones.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday 28 March 2008 17:21, Sam Mason wrote:
> On Fri, Mar 28, 2008 at 05:06:10PM -0400, Terry Lee Tucker wrote:
> > HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.
> >
> > The problem is a line like 'UPDATE bill SET notes = 'blah, blah,
> > yea\nmore stuff';
> >
> > How to I escape the newline embeded in the string? I've tried the advice
> > from HINT, but have been unable to get it to work.
>
> The statement would become:
>
> UPDATE bill SET notes = E'blah, blah, yea\nmore stuff';
>
> Is this what you tried? I couldn't tell from your message. If you did,
> then maybe your database drivers are somehow mangling the statement
> somewhere between your code and the database. You could try running it
> locally from inside psql to find out.
>
>
> Sam

Thanks Sam. No, that is not what I tried. I had tried:
UPDATE bill SET notes = 'blah, blah, yeaE'\n'more stuff.'
It didn't dawn on me that the E went in front of the whole string!

Thanks for the help...
--
Terry Lee Tucker
Turbo's IT Manager
Turbo, division of Ozburn-Hessey Logistics
2251 Jesse Jewell Pkwy NE
Gainesville, GA 30501
Tel: (336) 372-6812 Fax: (336) 372-6812 Cell: (336) 404-6987
terry(at)turbocorp(dot)com
www.turbocorp.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2008-03-28 21:49:26 Re: Escaping \n
Previous Message Sam Mason 2008-03-28 21:21:48 Re: Escaping \n