array of bytea;

Started by Tom DalPozzoabout 9 years ago2 messagesgeneral
Jump to latest
#1Tom DalPozzo
t.dalpozzo@gmail.com

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tom DalPozzo (#1)
Re: array of bytea;

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

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general