Thread

  1. bug in PLPGSQL

    Andriy I Pilipenko <bamby@marka.net.ua> — 2001-03-28T09:56:13Z

    
    Your name		:	Andriy I Pilipenko
    Your email address	:	bamby@marka.net.ua
    
    
    System Configuration
    ---------------------
      Architecture (example: Intel Pentium)  	: Intel Pentium
    
      Operating System (example: Linux 2.0.26 ELF) 	: FreeBSD-4.2-STABLE
    
      PostgreSQL version (example: PostgreSQL-7.0):   PostgreSQL-7.0.3
    
      Compiler used (example:  gcc 2.8.0)	: gcc version 2.95.2 19991024 (release)
    
    
    Please enter a FULL description of your problem:
    ------------------------------------------------
    
    There is bug in PLPGSQL. If one of the parameters to plpgsql function is
    null, other parameters becomes null too.
    
    
    Please describe a way to repeat the problem.   Please try to provide a
    concise reproducible example, if at all possible: 
    ----------------------------------------------------------------------
    
    First create function like this:
    
        CREATE FUNCTION f(varchar, varchar) RETURNS varchar
          AS '
        begin
    	return ''first arg is: '' || $1;
        end;
        ' LANGUAGE 'plpgsql';
    
    Then run query "SELECT f('some text', NULL)" and you will receive null
    value.
    
    
    If you know how this problem might be fixed, list the solution below:
    ---------------------------------------------------------------------