Re: Convert from hex to string

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Francisco Olarte <folarte(at)peoplecall(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Yuriy Rusinov <yrusinov(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Convert from hex to string
Date: 2015-12-07 00:47:00
Message-ID: 5664D704.7010201@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/26/15 1:12 AM, Francisco Olarte wrote:
> Anyway, I think people should be told to respect types, and people
> should be teach that strings are sequences of characters, that to do
> what people think is 'hex encoding' ( two digits per*byte*, no
> delimiter ), you need to first transform the string to bytes, then
> hex-encode that.

BTW, it wouldn't be that difficult to create a hex data type that worked
like bytea but accepted only hex strings. Likewise for a base64 type.
Only downside is you'd probably have to do it in C, because no other
language can handle cstring and I don't think there's any built-in
conversion functions with the correct parameters.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2015-12-07 00:56:02 Re: FATAL: unable to read data from DB node 0
Previous Message Jim Nasby 2015-12-07 00:28:07 Re: plperlu stored procedure seems to freeze for a minute