concatenating text and bytea - Mailing list pgsql-general

From Vincent de Phily
Subject concatenating text and bytea
Date
Msg-id 1366684.UTYyVzsmQ2@moltowork
Whole thread Raw
Responses Re: concatenating text and bytea
List pgsql-general

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

 

pgsql-general by date:

Previous
From: ChoonSoo Park
Date:
Subject: Re: Opposite function of hstore each function
Next
From: Tom Lane
Date:
Subject: Re: concatenating text and bytea