Handling of \ in array data display - Mailing list pgsql-bugs

From Josh Berkus
Subject Handling of \ in array data display
Date
Msg-id 200608181439.36527.josh@agliodbs.com
Whole thread Raw
Responses Re: Handling of \ in array data display  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-bugs
Issue: \ is escaped oddly when displaying the contents of array fields.
Severity: annoyance
Affects: 8.1.3, 8.1.4, 8.0.3, possibly others.
Demonstration of bug:

When saving \ escaped values into text array fields, the \ is escaped when
displaying the contents of the array, leading to an appearance that the
correct data was not saved:

scratch=# create table test_arr ( tarr text[] );
CREATE TABLE
scratch=# insert into test_arr values ( array['x\y','x\\y','x y'] );
INSERT 5695623 1
scratch=# select * from test_arr;
       tarr
-------------------
 {xy,"x\\y","x y"}
(1 row)

scratch=# select tarr[1] from test_arr;
 tarr
------
 xy
(1 row)

scratch=# select tarr[2] from test_arr;
 tarr
------
 x\y
(1 row)

--
--Josh

Josh Berkus
PostgreSQL @ Sun
San Francisco

pgsql-bugs by date:

Previous
From: Joel Stevenson
Date:
Subject: Website issue
Next
From: Alvaro Herrera
Date:
Subject: Re: Handling of \ in array data display