On Tue, Sep 2, 2008 at 2:57 PM, Tom Lane <[EMAIL PROTECTED]> wrote: > "Neil Conway" <[EMAIL PROTECTED]> writes: > >> Returning regtype seems like the natural choice. > > I was just about to say the same.
Yes. In fact, the way I typically use the function is to write gettype(whatever)::regtype. I was too lazy to modify the function to return regtype, and with "::regtype" weighing in at a mere 9 keystrokes there wasn't much motivation =) > 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. Good tip. > 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() ? > Sure, pg_typeof() sounds good. I only used gettype() because it was a familiar name (PHP has an analogous builtin function called gettype()). > Oh, another thing: it shouldn't be STRICT. Nulls have perfectly good > types. > Agreed. Barring any further comments/objections, I'll go ahead and prepare a patch to add this to core. Cheers, BJ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers