"Neil Conway" <neilc@samurai.com> writes:
> On Mon, Sep 1, 2008 at 9:35 PM, Brendan Jurd <direvus@gmail.com> wrote:
>> +1. I've been using a variation on this theme (it returns the type
>> OID, not a text value) for a couple of years.
> Returning regtype seems like the natural choice.
I was just about to say the same. Another thought is that you might as
well declare the input type as "any" --- using "anyelement" just causes
the parser to waste a few cycles checking for argument/result type
conflicts that can't exist here.
I don't like gettype() as the function name: it's not particularly
readable and it seems to infringe on application namespace. It should
be pg_something ... maybe pg_typeof() ?
Oh, another thing: it shouldn't be STRICT. Nulls have perfectly good
types.
regards, tom lane