strange behaviour in plpgsql:null arguments

From: "Peter Filipov" <pfilipov(at)netissat(dot)bg>
To: pgsql-general(at)postgresql(dot)org
Subject: strange behaviour in plpgsql:null arguments
Date: 2005-11-28 13:39:37
Message-ID: ops0ydkbq8ligf9v@draco
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex 2005-11-28 14:12:57 Help with COPY Error: invalid UTF-8 byte ....
Previous Message Michael Glaesemann 2005-11-28 12:23:03 Re: regarding the apostrophe character