PL/PgSQL bug?

From: "Nikola Milutinovic" <Nikola(dot)Milutinovic(at)ev(dot)co(dot)yu>
To: "PostgreSQL general" <pgsql-general(at)postgresql(dot)org>
Subject: PL/PgSQL bug?
Date: 2001-07-25 13:59:25
Message-ID: 000f01c11512$03872e30$0a3ea8c0@ev.co.yu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all.

I have noticed a strange bug/feature in PL/PgSQL language. Whenever I pass 'null' as one of the parameters, every argument becomes 'null'.

For example:

CREATE FUNCTION div_mod( int4, text, int4, bool, int2 ) RETURNS int4 AS '
BEGIN
IF $1 ISNULL THEN
RETURN 2;
END IF;
RETURN 0;
END;
' LANGUAGE 'plpgsql';

Now perform:
mercury# select div_mod( 1, 'Test', null, 't' 10 );
div_mod
-----------
2

Although the function is called with $1 = 1, it is 'null' in this case. Actually all $n parameters are 'null'. PostgreSQL version is:

mercury=# select version();
version
--------------------------------------------------------
PostgreSQL 7.0.2 on alpha-dec-osf4.0f, compiled by cc
(1 row)

Is this a bug or a feature?

Nix.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Josh Berkus 2001-07-25 15:14:09 Re: Re: Inserts in triggers Follow Up
Previous Message Morgan Curley 2001-07-25 13:09:54 Re: Inserts in triggers Follow Up