Обсуждение: Bug #749: one NULL function parameter makes all other NULL

Поиск
Список
Период
Сортировка

Bug #749: one NULL function parameter makes all other NULL

От
pgsql-bugs@postgresql.org
Дата:
Laurent HERVE (laurent-herve@club-internet.fr) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
one NULL function parameter makes all other NULL

Long Description
I don't know if this is really a bug but it seems like for me and it is very annoying. I checked all release notes of
recentreleases to find some king of bug fix for that, without sucess. 
I know, my postgresql version is a little bit old, but I cannot upgrade know.
But I just want to know if that bug is known and corrected in recent release.
So here it is :

test=# create function foo(date,char(10))
test-# returns integer
test-# as '
test-# declare
test-#         p1 alias for $1;
test-#         p2 alias for $2;
test-# begin
test-#         raise notice ''% %'',p1,p2;
test-#         return (''1'');
test-# end;'
test-# language 'plpgsql';
test-#
CREATE

test=# select foo('2002-05-02','236');
NOTICE:  2002-05-02 236
 foo
-----
   1
(1 row)

test=# select foo('2002-05-02',NULL);
NOTICE:  <NULL> <NULL>
foo
-----
   1
(1 row)

So why the first parameter became NULL ?

test=# select version();
                           version
-------------------------------------------------------------
 PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc 2.96
(1 row)



Sample Code


No file was uploaded with this report

Re: Bug #749: one NULL function parameter makes all other

От
Stephan Szabo
Дата:
On Tue, 27 Aug 2002 pgsql-bugs@postgresql.org wrote:

> Laurent HERVE (laurent-herve@club-internet.fr) reports a bug with a severity of 2
> The lower the number the more severe it is.
>
> Short Description
> one NULL function parameter makes all other NULL
>
> Long Description I don't know if this is really a bug but it seems
> like for me and it is very annoying. I checked all release notes of
> recent releases to find some king of bug fix for that, without sucess.
> I know, my postgresql version is a little bit old, but I cannot
> upgrade know. But I just want to know if that bug is known and
> corrected in recent release. So here it is :

Fixed as of 7.2 IIRC. (Although you can make a function strict
to get the older behavior)