Re: Re: SELECT Field1 || Field2 FROM Table

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: Jean-Michel POURE <jm(dot)poure(at)freesurf(dot)fr>
Cc: pgsql-hackers(at)postgresql(dot)org, Robert Forsman <thoth(at)purplefrog(dot)com>
Subject: Re: Re: SELECT Field1 || Field2 FROM Table
Date: 2001-06-14 14:39:32
Message-ID: Pine.BSO.4.10.10106141033260.17529-100000@spider.pilosoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

plpgsql is a bit tricky.

In 7.0, if an argument to a function was null, function did not execute at
all, and the result was assumed null.

In 7.1, you can control this behaviour by declaring function as 'strict'
or 'nostrict'. ex: create function(...) as '...' with (strict) gets old
behaviour, nostrict will do what you want.

On Thu, 14 Jun 2001, Jean-Michel POURE wrote:

> Hello Robert (Bob?),
>
> Thank you for your answer. I will surely make a wide use the COALESCE
> function in my scripts.
> I also noticed the same behaviour in PL/pgSQL:
>
> CREATE FUNCTION "xxxxxxxxxxxxxx" (text, text)
> RETURNS text
> AS 'BEGIN
>
> RETURN $1 || ' ' || $2;
> END;
> '
> LANGUAGE 'plpgsql'
>
> Correct me if I am wrong:
>
> It seems that a NULL value is not passed to the function ...
> ... or is it that a NULL value is not taken into account by PL/pgSQL.
>
> Thank you all for the COALESCE trick.
>
> Greetings from Jean-Michel POURE, Paris, France
> pgAdmin development team
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-06-14 15:15:07 Re: [PATCHES] Removal of temp tables
Previous Message Tom Lane 2001-06-14 14:37:57 Re: 7.0.3 database corruption