From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
---|---|
To: | Andre Lopes <lopes80andre(at)gmail(dot)com> |
Cc: | postgresql Forums <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Problem saving emails to database. |
Date: | 2010-04-25 18:18:12 |
Message-ID: | 4BD48764.9040404@iol.ie |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 25/04/2010 18:31, Andre Lopes wrote:
> Let me explain the problem... I'am sending text emails, and to break the
> lines of the message I use "\n". The first problem was to stores the
> "\". To INSERT "\n" I need to write "\\n". When I do a SELECT I see "\n"
> but when I dump the database in the INSERTS I see "\\n".
I think, strictly speaking, you should have E'\\n' in the INSERT in
order to escape the backslashes properly:
postgres=# select '\\n';
WARNING: nonstandard use of \\ in a string literal
LINE 1: select '\\n';
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
?column?
----------
\n
(1 row)
postgres=# select E'\\n';
?column?
----------
\n
(1 row)
> The problem with this is that when I send an email the "\n" that I see
> in the SELECT returns simply "n" in the email and does not break the line.
What are you using to run the queries and generate the emails? PHP? It
sounds to me as if something else is doing something funny with the
backslash after it gets it from the database.
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-04-25 18:32:29 | Re: Plpgsql function syntax error at first coalesce statement |
Previous Message | Samuel | 2010-04-25 18:00:29 | Re: Help me stop postgres from crashing. |