Re: [RFC] new digest datatypes, or generic fixed-len hex types?

From: decibel <decibel(at)decibel(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: [RFC] new digest datatypes, or generic fixed-len hex types?
Date: 2009-07-29 17:16:48
Message-ID: 0ED03D5D-33F1-4220-B151-A1AE566B7533@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jul 28, 2009, at 6:15 AM, Peter Eisentraut wrote:
> On Monday 27 July 2009 14:50:30 Alvaro Herrera wrote:
>> We've developed some code to implement fixed-length datatypes for
>> well
>> known digest function output (MD5, SHA1 and the various SHA2 types).
>> These types have minimal overhead and are quite complete, including
>> btree and hash opclasses.
>>
>> We're wondering about proposing them for inclusion in pgcrypto. I
>> asked
>> Marko Kreen but he is not sure about it; according to him it would be
>> better to have general fixed-length hex types. (I guess it would be
>> possible to implement the digest types as domains over those.)
>
> I think equipping bytea with a length restriction would be a very
> natural,
> simple, and useful addition. If we ever want to move the bytea
> type closer to
> the SQL standard blob type, this will need to happen anyway.
>
> The case for separate fixed-length data types seems very dubious,
> unless you
> can show very impressive performance numbers. For one thing, they
> would make
> the whole type system more complicated, or in the alternative,
> would have
> little function and operator support.
bytea doesn't cast well to and from text when you're dealing with hex
data; you end up using the same amount of space as a varchar. What
would probably work well is a hex datatype that internally works like
bytea but requires that the input data is hex (I know you can use
encode/decode, but that added step is a pain). A similar argument
could be made for base64 encoded data.
--
Decibel!, aka Jim C. Nasby, Database Architect decibel(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hitoshi Harada 2009-07-29 17:20:17 Re: slow count in window query
Previous Message decibel 2009-07-29 17:11:42 Re: Higher TOAST compression.