RE: PL/PgSQL bug?

From: Jeff Eckermann <jeckermann(at)verio(dot)net>
To: "'Nikola Milutinovic'" <Nikola(dot)Milutinovic(at)ev(dot)co(dot)yu>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: RE: PL/PgSQL bug?
Date: 2001-07-25 16:04:25
Message-ID: 08CD1781F85AD4118E0800A0C9B8580B094B5E@NEZU
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This is a well known bug/feature. You can find plenty of discussion of it
in the mailing list archives.
Fixed in version 7.1.x.

> -----Original Message-----
> From: Nikola Milutinovic [SMTP:Nikola(dot)Milutinovic(at)ev(dot)co(dot)yu]
> Sent: Wednesday, July 25, 2001 8:59 AM
> To: PostgreSQL general
> Subject: [GENERAL] PL/PgSQL bug?
>
> 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.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

Browse pgsql-general by date

  From Date Subject
Next Message Howard Williams 2001-07-25 16:11:25 Can Postgres handle 2-phase commits ?
Previous Message Lee Harr 2001-07-25 15:57:46 Re: pqReadData() -- backend closed the channel unexpectedly.