Re: UUID's as primary keys

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Thomas Hallgren <thomas(at)tada(dot)se>
Cc: Psql_General <pgsql-general(at)postgresql(dot)org>
Subject: Re: UUID's as primary keys
Date: 2006-06-28 08:39:51
Message-ID: 20060628083951.GC29253@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Jun 28, 2006 at 10:22:45AM +0200, Thomas Hallgren wrote:
> Thanks. That would of course work but at the same time it increases the
> complexity of my app. Yet another component to install and keep track
> of. It's also a bit of an overkill since the only thing I need is an
> opaque bit storage. Why is it that PostgreSQL lack a fixed length binary
> type similar to the RAW type in Oracle? ISTM that could be very useful
> and not very hard to implement.

AIUI, it can't be done because of a basic rule of the type system: the
typmod can't be necessary to interpret the binary representation of a
value. For something like RAW(16) the type would be the oid for "raw"
and the typmod would be 16. However, when reading the value from a disk
page, you're not given the typmod, so you have no way of determining
the length.

That's why there is a verlena header for types where you don't know the
length, which adds overhead. The alternative is to create a type of the
exact length you want, but in your case that's not acceptable either.

I'm not sure if there are any other alternatives.

Have a ncie day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Franz.Rasper 2006-06-28 08:59:53 Re: RAID + PostgreSQL?
Previous Message Thomas Hallgren 2006-06-28 08:22:45 Re: UUID's as primary keys

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2006-06-28 09:09:23 Re: GIN index creation extremely slow ?
Previous Message Thomas Hallgren 2006-06-28 08:22:45 Re: UUID's as primary keys