rogerdpack
rogerdpack

Reputation: 66961

error function decode(bytea unknown) does not exist

when I run this query in Postgres, on a bytea column:

SELECT decode(column_name, 'escape') FROM table_name;

I get this failure: error function decode(bytea unknown) does not exist

Upvotes: 3

Views: 6067

Answers (1)

rogerdpack
rogerdpack

Reputation: 66961

Seems I got it flipped, you can use the decode method on inserts, ex:

 insert into table_name values (decode(E'abc123\\000456', 'escape'));

but not use it on selects, should be this instead

SELECT encode(column_name, 'escape') FROM table_name;

Upvotes: 5

Related Questions