I'm running:

colin=# select version();
                                                          version
---------------------------------------------------------------------------------------------------------------------------
PostgreSQL 8.1.1 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
(1 row)

My problem is as follows:

given this table:
create table test ( c1 text, c2 text[] );

I am having trouble inserting a value into the array column that contains a single '\' (no quotes) character. The following examples are my attempts to produce a value of 'x\y' (no quotes) in both the regular text and the text array columns in the test table:

insert into test values ( 'x\\y', array['x\\y']);

 c1  |    c2
-----+----------
 x\y | {"x\\y"}
(1 row)

while:

insert into test  values ( 'x\\y', array['x\y']);

 c1  |    c2
-----+----------
 x\y | {xy}
(1 row)

I also tried:

insert into test values ( 'x\\y', array[$$x\y$$]);

 c1  |    c2
-----+----------
 x\y | {"x\\y"}
(1 row)

and:

insert into test values ( 'x\\y', '{x\y}');

 c1  |    c2
-----+----------
 x\y | {xy}
(1 row)

and:

insert into test values ( 'x\\y', '{x\\y}');

 c1  |  c2
-----+------
 x\y | {xy}
(1 row)

and:

insert into test values ( 'x\\y', '{x\\\\y}');

 c1  |    c2
-----+----------
 x\y | {"x\\y"}
(1 row)

just to be complete, I also tried this:

insert into test values ( 'x\\y', '{x\\\y}');

 c1  |  c2
-----+------
 x\y | {xy}
(1 row)

I found an article that may be releated, but didn't provide much insight: http://archives.postgresql.org/pgsql-bugs/2001-11/msg00162.php (at least to me).

Any help that can be offered will be greatly appreciated.  Thanks.

- Colin


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to