Re: Fixed length datatypes. WAS [GENERAL] UUID's as - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Fixed length datatypes. WAS [GENERAL] UUID's as
Date
Msg-id 23967.1151764679@sss.pgh.pa.us
Whole thread Raw
In response to Re: Fixed length datatypes. WAS [GENERAL] UUID's as  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Fixed length datatypes. WAS [GENERAL] UUID's as  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Fixed length datatypes. WAS [GENERAL] UUID's as  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> It would also be possible to provide two functions called hex_raw_in()
> and hex_raw_out() that people could use like so:

> CREATE TYPE uuid (
>   input = hex_raw_in,
>   output = hex_raw_out,
>   INTERNALLENGTH = 16
> );

> Where these input/output functions would work for any given length, so
> the 16 could be replaced by any number, or even -1 to make a variable
> length type...

I believe you could make an input function that would support that,
though it would have to do a catalog lookup to find out the desired
type length.  The output function, however, would be quite a trick.
It's not going to receive anything except the Datum itself.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Fixed length datatypes. WAS [GENERAL] UUID's as
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Fixed length datatypes. WAS [GENERAL] UUID's as