Skip site navigation (1) Skip section navigation (2)

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 (view raw, whole thread or download thread mbox)
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 :)

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)


pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group