strange behaviour in plpgsql:null arguments - Mailing list pgsql-general

From Peter Filipov
Subject strange behaviour in plpgsql:null arguments
Date
Msg-id ops0ydkbq8ligf9v@draco
Whole thread Raw
Responses Re: strange behaviour in plpgsql:null arguments
List pgsql-general
Hi, I think I found something that is strange.
I can't detect whether i passed a NULL to stored procedure
in plpgsql when it happens that I use composites
I warn that I haven't read the sql standards though.
Here is the code:

CREATE TYPE ttype AS (
    t1 int,
    t2 int
);

CREATE OR REPLACE FUNCTION ttypetest(t ttype) RETURNS ttype AS $$
BEGIN
    IF t IS NULL THEN
        RAISE EXCEPTION 'NULL input';
    END IF;
    RETURN t;
END
$$ LANGUAGE plpgsql;

SELECT ttypetest(NULL);

I also find it quite difficult to unset an element from array in postgres.


Regards,
Peter Filipov

pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: regarding the apostrophe character
Next
From: Alex
Date:
Subject: Help with COPY Error: invalid UTF-8 byte ....