From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Bill Moran <wmoran(at)potentialtech(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Inserting string with a " into an array using {} syntax ... possible? |
Date: | 2009-03-13 14:55:28 |
Message-ID: | 20090313145527.GC4379@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Bill Moran wrote:
> bill=# insert into testarray (a) values (E'{"text \\"for you\\"","moretext"}');
> INSERT 0 1
> bill=# select * from testarray;
> a | id
> -------------------------------+----
> {"text \"for you\"",moretext} | 3
Actually this one is good. It gets the backslashes in the output because the "
need to be escaped there too ('cause it's an array). But if you output a
single element, they are not there:
alvherre=# insert into f values (E'{"text \\"for you\\" some"}');
INSERT 0 1
alvherre=# select * from f;
a
---------------------------
{"text \"for you\" some"}
(1 fila)
alvherre=# select a[1] from f;
a
---------------------
text "for you" some
(1 fila)
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
From | Date | Subject | |
---|---|---|---|
Next Message | Alan Hodgson | 2009-03-13 15:53:47 | Re: postmaster hangs on delete from |
Previous Message | Tino Wildenhain | 2009-03-13 14:44:58 | Re: Transactions in user defined function |