Re: NULL values and string - Mailing list pgsql-general

From Berend Tober
Subject Re: NULL values and string
Date
Msg-id 43E20FE9.2060401@seaworthysys.com
Whole thread Raw
In response to Re: NULL values and string  (Richard Huxton <dev@archonet.com>)
List 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



pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: plpgsql parameters
Next
From: "Justin Pasher"
Date:
Subject: Re: Best way to handle table trigger on update