Re: Mysterious Bus Error with get_fn_expr_argtype()

From: "Brendan Jurd" <direvus(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Neil Conway" <neilc(at)samurai(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Mysterious Bus Error with get_fn_expr_argtype()
Date: 2008-09-02 05:31:34
Message-ID: 37ed240d0809012231j60b1eeb5rf26a7c7356f35f36@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 2, 2008 at 2:57 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Neil Conway" <neilc(at)samurai(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Koichi Suzuki 2008-09-02 06:06:41 Full page write improvement: new WAL archive command (beta) released
Previous Message Hitoshi Harada 2008-09-02 05:03:38 Re: Window functions patch v04 for the September commit fest