Search Postgresql Archives

concatenating text and bytea

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

 



Hi,

 

I got recently bitten by this :

 

# select 'ascii'::text || E'\\xdeadbeef'::bytea, pg_typeof('ascii'::text || '\xdeadbeef'::bytea), 'ascii'::bytea || E'\\xdeadbeef'::bytea;

?column? | pg_typeof | ?column?

-----------------+-----------+----------------------

ascii\xdeadbeef | text | \x6173636969deadbeef

 

 

I would have expected a result cast as bytea or an error message telling me about incompatible types, but the result from the first column is a nasty gotcha. Is it the intented behaviour ?

 

 

--

Vincent de Phily

 


[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