Re: NULL values and string

From: Berend Tober <btober(at)seaworthysys(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Sergey Karin <sergey(dot)karin(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: NULL values and string
Date: 2006-02-02 13:58:01
Message-ID: 43E20FE9.2060401@seaworthysys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton wrote:

> Sergey Karin wrote:
>
>> Are there any abilities to represent NULL values as string?
>
>
> Null isn't a real value. Try not to think of it as a value.
>
That being said, and with due credit elsewhere (http://www.varlena.com/varlena/GeneralBits/84.php), what I do is

CREATE OR REPLACE FUNCTION public.textcat_null(text, text)
RETURNS text AS
'SELECT textcat(COALESCE($1, ''''), COALESCE($2, ''''));'
LANGUAGE sql' VOLATILE;

CREATE OPERATOR public.||+(
PROCEDURE = "public.textcat_null",
LEFTARG = text,
RIGHTARG = text);

This goes against proper form, considering what NULL is designed for, but it sure is convenient.

Regards,
Berend Tober

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Justin Pasher 2006-02-02 14:58:29 Re: Best way to handle table trigger on update
Previous Message Richard Huxton 2006-02-02 13:32:49 Re: plpgsql parameters