![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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[2] from test_arr; tarr ------ x\y (1 row) |
#3
| |||
| |||
|
|
tarr[1] does not have a \, because it was eaten by the parser (so \y is the same as a plain y). tarr[2] does have a single backslash, which for output purposes is shown escaped with another backslash when part of an array, but unescaped when not. I'm not sure if this qualifies as a bug or not. |
#4
| |||
| |||
|
|
tarr[1] does not have a \, because it was eaten by the parser (so \y is the same as a plain y). tarr[2] does have a single backslash, which for output purposes is shown escaped with another backslash when part of an array, but unescaped when not. I'm not sure if this qualifies as a bug or not. I think it does. |
#5
| |||
| |||
|
|
This is documented behavior for arrays: http://developer.postgresql.org/docs...s.html#AEN5764 and has been that way for a very long time. If we change it we will break every array-using application on the planet, because it will in fact be impossible to parse an array value unambiguously. |
![]() |
| Thread Tools | |
| Display Modes | |
| |