insert a backslash into a bytea field?

Поиск
Список
Период
Сортировка
Искать

insert a backslash into a bytea field?

От:
Kevin Kempter <kevink@consistentstate.com>
Дата:
Hi all;

we want to insert a single backslash into a bytea column (running postgres v 
8.3.5)

this works to insert 2 backslashes (but we only want one):
insert into test_bytea_tab (id, bytea_test_col) 
values(999999, '\\\\testdata'::bytea)

However none of these work:

insert into test_bytea_tab (id, bytea_test_col) 
values(999999, '\\testdata'::bytea)

insert into test_bytea_tab (id, bytea_test_col) 
values(999999, E'\\testdata'::bytea)


FWIW backslash_quote is set to 'safe_encoding'

Thoughts?


Thanks in advance

Re: insert a backslash into a bytea field?

От:
Tim Landscheidt <tim@tim-landscheidt.de>
Дата:
Kevin Kempter  wrote:

> we want to insert a single backslash into a bytea column (running postgres v
> 8.3.5)

> this works to insert 2 backslashes (but we only want one):
> insert into test_bytea_tab (id, bytea_test_col)
> values(999999, '\\\\testdata'::bytea)
> [...]

This inserts a single backslash. Check
LENGTH(bytea_test_col).

Tim
FAQ