convert int to bytea

ohp@pyrenet.fr

From: ohp@pyrenet.fr
To: pgsql-hackers list <pgsql-hackers@postgresql.org>
Date: 2007-11-29T13:44:58Z
Lists: pgsql-hackers
Hi all,

I'm trying to write a trigger that converts integer to bytea.
My schema is like this:

Create table xx (
id int,
....
...
data bytea);

the first 3 bytes of data are the binary representation of id
(id  is extracted from data by  the application)

I can occur that id change in that case data has to change too!

select 124::bytea doesn't work

Is there an other way? (preferabily simple :)

Regards
-- 
Olivier PRENANT        	        Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges                +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
FRANCE                          Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)