Search Postgresql Archives

bytea hex input/output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Silly little question, but is there something to input/output hex
escaped data into a bytea, ala

CREATE TABLE a (lob BYTEA);
INSERT into a (lob) VALUES ('\x01\x02\x00\x03\x04');
INSERT into a (lob) VALUES ('\x01\x00\x02\x00\x03\x04');

It seems to work (doesn't error), but when selecting the data back out,
it is truncated at the first \x00, ala

SELECT lob FROM a;

  lob
----------
 \001\002
 \001

SELECT octet_length(lob) from a;

 octet_length
--------------
            2
            1

Why does this happen?  Also, can I get the output in similar hex form?



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux