Обсуждение: [GENERAL] array of bytea;

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

[GENERAL] array of bytea;

От
Tom DalPozzo
Дата:
Hi,
I created a table:
CREATE TABLE MYTABLE (DATA BYTEA[]);

Now, I'd like to insert some values (a '\x0011' and a '\x2233') but I can't find a right way.
I tried without success INSERT INTO MYTABLE VALUES ('{'\x0011','\x2233'}');
What's wrong?

Thanks
Pupillo

Re: [GENERAL] array of bytea;

От
Tom Lane
Дата:
Tom DalPozzo <t.dalpozzo@gmail.com> writes:
> I tried without success INSERT INTO MYTABLE VALUES ('{'\x0011','\x2233'}');
> What's wrong?

You've ignored the rules about how to write element values within an
array literal:
https://www.postgresql.org/docs/current/static/arrays.html#ARRAYS-IO

Personally I tend to write an ARRAY[] construct in preference to
manually adding extra quotes and backslashes to such values.

            regards, tom lane