Re: [HACKERS] Composite IS NULL again, this time with plpgsql

2017-03-18 Thread Tom Lane
Andrew Gierth writes: > This obviously happens because plpgsql is storing the variable as an > expanded list of fields rather than as a single composite datum, and > rebuilding the datum value when it needs to be passed to SQL for > evaluation. Without an "isnull" flag for each composite subvalue

[HACKERS] Composite IS NULL again, this time with plpgsql

2017-03-18 Thread Andrew Gierth
This came up recently on irc: create type t1 as (a integer, b integer); create type t2 as (p t1, q t1); create function null_t2() returns t2 language sql as $f$ select null::t2; $f$; Now consider the following plpgsql: declare v t2; begin v := null_t2(); raise info 'v is null = %', v is