convert int to bytea

From: ohp(at)pyrenet(dot)fr
To: pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: convert int to bytea
Date: 2007-11-29 13:44:58
Message-ID: Pine.UW2.4.53.0711291438060.13487@sun.pyrenet
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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(at)pyrenet(dot)fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message NikhilS 2007-11-29 13:51:16 Re: [pgsql-www] Time to update list of contributors
Previous Message Jorgen Austvik - Sun Norway 2007-11-29 13:26:24 Re: lo_export and lo_import: paths and servers