Re: Backslashitis

From: Raghavendra <raghavendra(dot)rao(at)enterprisedb(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Backslashitis
Date: 2012-06-14 09:03:56
Message-ID: CA+h6AhjyvYjcB2ET2WLRO7vZzqFOJAao36zoLO8xUjyOoAGhLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 14, 2012 at 2:19 PM, Thomas Kellerer <spam_eater(at)gmx(dot)net> wrote:

> hamann(dot)w(at)t-online(dot)de, 14.06.2012 10:17:
>
> Hi,
>>
>> I have a column declared as array of text. I can get a single backslash
>> into one of the array elements by
>> update ... set mycol[1] = E'blah \\here'
>> If I try to update the whole array
>> update ... set mycol = E'{"blah \\here"}'
>> the backslash is missing. I can get two backslashes there.
>> Is there a good way to solve the problem, other than rewriting my update
>> script to do array updates one element at a time?
>>
>>
> Setting
> standard_conforming_strings = true
>
> should do the trick.
>
> http://www.postgresql.org/**docs/current/static/runtime-**
> config-compatible.html#GUC-**STANDARD-CONFORMING-STRINGS<http://www.postgresql.org/docs/current/static/runtime-config-compatible.html#GUC-STANDARD-CONFORMING-STRINGS>
>
> In that case you don't need any escaping inside the string literals.
>
> Regards
> Thomas
>
>
Nope..

postgres=# show standard_conforming_strings ;
standard_conforming_strings
-----------------------------
on
(1 row)
postgres=# set standard_conforming_strings =on;
SET
postgres=# show standard_conforming_strings ;
standard_conforming_strings
-----------------------------
on
(1 row)
postgres=# update array_test set name=E'{"meet\\ing"}';
UPDATE 2
postgres=# select * from array_test ;
name
-----------
{meeting}
{meeting}
(2 rows)

Correct me, if anything wrong.

--Raghav

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yuriy Rusinov 2012-06-14 09:08:08 Re: Reference with inheritance propagate data
Previous Message Thomas Kellerer 2012-06-14 08:49:27 Re: Backslashitis