[GENERAL] converting from bytea to integers

2009-04-20 Thread John DeSoi
I'd like to convert some bytea data to an array of four byte integers (and vice versa). I'm probably missing something obvious, but I don't see an efficient way to generate a 4 byte integer from a bytea string (could be big endian or little endian). Converting back to bytea seems easy

Re: [GENERAL] converting from bytea to integers

2009-04-20 Thread Daniel Verite
John DeSoi wrote: I'd like to convert some bytea data to an array of four byte integers (and vice versa). I'm probably missing something obvious, but I don't see an efficient way to generate a 4 byte integer from a bytea string (could be big endian or little endian).

Re: [GENERAL] converting from bytea to integers

2009-04-20 Thread John DeSoi
On Apr 20, 2009, at 5:23 PM, Daniel Verite wrote: get_byte()? mailtest= \set e '\'\12\15\107\20\'::bytea' mailtest= select get_byte(:e,0),get_byte(:e,1),get_byte(:e, 2),get_byte(:e,3); get_byte | get_byte | get_byte | get_byte --+-- +--+-- 10 |