Re: Mysterious Bus Error with get_fn_expr_argtype() - Mailing list pgsql-hackers

From Brendan Jurd
Subject Re: Mysterious Bus Error with get_fn_expr_argtype()
Date
Msg-id 37ed240d0809012231j60b1eeb5rf26a7c7356f35f36@mail.gmail.com
Whole thread Raw
In response to Re: Mysterious Bus Error with get_fn_expr_argtype()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Mysterious Bus Error with get_fn_expr_argtype()  ("David E. Wheeler" <david@kineticode.com>)
List pgsql-hackers
On Tue, Sep 2, 2008 at 2:57 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Neil Conway" <neilc@samurai.com> 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


pgsql-hackers by date:

Previous
From: "Hitoshi Harada"
Date:
Subject: Re: Window functions patch v04 for the September commit fest
Next
From: Koichi Suzuki
Date:
Subject: Full page write improvement: new WAL archive command (beta) released