Re: [HACKERS] Bug with plpgsql handling of NULL argument of compound type

2016-07-22 Thread Tom Lane
Alvaro Herrera writes: > On this topic, see also > https://www.postgresql.org/message-id/20160708024746.1410.57...@wrigleys.postgresql.org I'd forgotten about that thread :-( ... but on looking at it, it's very relevant indeed. See my followup there.

Re: [HACKERS] Bug with plpgsql handling of NULL argument of compound type

2016-07-22 Thread Alvaro Herrera
Tom Lane wrote: > Merlin Moncure writes: > > Not sure we are guided there. Currently we follow the spec > > specifically with the IS NULL operator but not in other cases. > > Yeah. ExecEvalNullTest() has been taught about this, but most other > places that check null-ness

Re: [HACKERS] Bug with plpgsql handling of NULL argument of compound type

2016-07-22 Thread David G. Johnston
On Fri, Jul 22, 2016 at 3:04 PM, Merlin Moncure wrote: > On Fri, Jul 22, 2016 at 1:39 PM, David G. Johnston > wrote: > > On Fri, Jul 22, 2016 at 2:13 PM, Tom Lane wrote: > >> > >> There is a rather squishy question as to

Re: [HACKERS] Bug with plpgsql handling of NULL argument of compound type

2016-07-22 Thread Tom Lane
Merlin Moncure writes: > Not sure we are guided there. Currently we follow the spec > specifically with the IS NULL operator but not in other cases. Yeah. ExecEvalNullTest() has been taught about this, but most other places that check null-ness just check overall datum

Re: [HACKERS] Bug with plpgsql handling of NULL argument of compound type

2016-07-22 Thread Merlin Moncure
On Fri, Jul 22, 2016 at 1:39 PM, David G. Johnston wrote: > On Fri, Jul 22, 2016 at 2:13 PM, Tom Lane wrote: >> >> There is a rather squishy question as to whether NULL::composite_type >> should be semantically equivalent to

Re: [HACKERS] Bug with plpgsql handling of NULL argument of compound type

2016-07-22 Thread David G. Johnston
On Fri, Jul 22, 2016 at 2:13 PM, Tom Lane wrote: > There is a rather squishy question as to whether NULL::composite_type > should be semantically equivalent to ROW(NULL,NULL,...)::composite_type. > If it is, then the SELECT should have failed before even getting into the >

Re: [HACKERS] Bug with plpgsql handling of NULL argument of compound type

2016-07-22 Thread Jim Nasby
On 7/22/16 1:13 PM, Tom Lane wrote: There is a rather squishy question as to whether NULL::composite_type should be semantically equivalent to ROW(NULL,NULL,...)::composite_type. If it is, then the SELECT should have failed before even getting into the plpgsql function, because ROW(NULL,NULL) is

Re: [HACKERS] Bug with plpgsql handling of NULL argument of compound type

2016-07-22 Thread Tom Lane
Jim Nasby writes: > CREATE DOMAIN text_not_null AS text NOT NULL; > CREATE TYPE c AS( t text_not_null, i int ); > CREATE TABLE test_table( id serial, c c ); > CREATE OR REPLACE FUNCTION test_func(i test_table) RETURNS oid LANGUAGE > plpgsql AS $$ > BEGIN > RETURN

[HACKERS] Bug with plpgsql handling of NULL argument of compound type

2016-07-22 Thread Jim Nasby
CREATE DOMAIN text_not_null AS text NOT NULL; CREATE TYPE c AS( t text_not_null, i int ); CREATE TABLE test_table( id serial, c c ); CREATE OR REPLACE FUNCTION test_func(i test_table) RETURNS oid LANGUAGE plpgsql AS $$ BEGIN RETURN pg_typeof(i); END$$; SELECT test_func(NULL); ERROR: domain