On 03.11.2011 13:32, Archana Sachin Ghag wrote:
I have wriiten following simple function in postgresqlCREATE OR REPLACE FUNCTION "MySchema".add_user(p_name character varying, p_email1 character varying, p_email2 character varying) RETURNS bigint AS $BODY$ DECLARE userId bigint; BEGIN INSERT INTO "MySchema"."User"("Name" ,"EMail1" , "EMail2") VALUES ($1 , $2, $3) ; Select CURRVAL('"MySchema".user_seq_userid') into userId; return userid; END; $BODY$ LANGUAGE plpgsql VOLATILE STRICT Function works absoolutely fine if I provide values for all three parameters. Record gets inserted too. But if I pass NULL for say last parameter, using SELECT "MySchema".add_user('A' , 'A', NULL) function does not do anything and return zero.
Yeah. That's what STRICT means. http://www.postgresql.org/docs/9.1/static/sql-createfunction.html -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com -- Sent via pgsql-bugs mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
