postgresql 9.3 - Insert hex value in escape format (bytea) -
postgresql 9.3 - Insert hex value in escape format (bytea) -
how insert hex value \x320000000d2f2100 in escape format bytea field ?
bytea_output settings set escape
the bytea_output
setting has nil how bytea interpreted server, how it's sent client.
do want insert literal string \x320000000d2f2100
(as 7-bit ascii), i.e. producing bytes 0x5c 0x78 0x33 0x32 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x64 0x32 0x66 0x32 0x31 0x30 0x30
?
if so, escape backslash, documented in syntax escape
format bytea literals.
regress=> select bytea '\\x320000000d2f2100'; bytea ---------------------------------------- \x5c7833323030303030303064326632313030 (1 row)
do want insert bytes 0x32 0x00 0x00 0x00 0x0d 0x2f 0x21 0x00
, i.e. hex value? if so, don't escape backslash. doesn't matter setting of bytea_output
is.
regress=> select bytea '\x320000000d2f2100'; bytea -------------------- \x320000000d2f2100 (1 row)
postgresql-9.3 bytea
Comments
Post a Comment