Re: odd behavior/possible bug

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: odd behavior/possible bug
Дата
Msg-id 17647.1059073499@sss.pgh.pa.us
обсуждение исходный текст
Ответ на odd behavior/possible bug  (Joe Conway <mail@joeconway.com>)
Ответы Re: odd behavior/possible bug
Список pgsql-hackers
Joe Conway <mail@joeconway.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.

> 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?
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Nailah Ogeer
Дата:
Сообщение: Re: Postgres hash tables
Следующее
От: David Blasby
Дата:
Сообщение: Getting the current transaction's xid