Re: odd behavior/possible bug

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: odd behavior/possible bug
Date: 2003-07-24 20:47:59
Message-ID: 3F2045FF.4040804@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)com> writes:
>>So far so good. But look at this one:
>>regression=# select dwarray(null,null);
>>ERROR: cannot determine ANYARRAY/ANYELEMENT type because input is UNKNOWN
>
> That seems correct to me. What would you expect to happen? There's no
> type we could assign as the function's actual return type.

I see your point, but mine was that in this case I'd like a NULL
returned and I don't really care about the type. ISTM that NULL should
be able to morph into any type it needs to.

>>This call makes it all the way to ExecEvalArray(), which means that
>>dwarray() is getting evaluated even though it is declared STRICT and has
>>been called with NULL inputs. That shouldn't happen, should it?
>
> I think what is happening is that the SQL function is getting inlined,
> probably because the inlining logic thinks ARRAY[] is strict and so
> there'd be no change in semantics.
>
> We could probably hack the inlining logic to prevent it from inlining
> the function in this scenario, but I wonder whether this doesn't say
> that ExecEvalArray is behaving inconsistently. In other operations, any
> NULL in means NULL out. Shouldn't it simply quietly return a NULL array
> if one of the supplied elements is NULL?

That probably makes good sense, at least until we can deal with NULL
elements. Would that patch count as a bug fix?

Joe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-07-24 21:05:21 Re: php with postgres
Previous Message Larry Rosenman 2003-07-24 20:35:02 Re: libpq_r

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-07-24 21:13:33 Re: odd behavior/possible bug
Previous Message Tom Lane 2003-07-24 19:04:59 Re: odd behavior/possible bug