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