Re: How do I check for NULL

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Igor Korot <ikorot01(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How do I check for NULL
Date: 2025-12-09 02:44:01
Message-ID: CAKFQuwa0QT01k7yVQJOQ2oMeQQWOQ+NSeYYyY3-8sqNYLQvBOA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday, December 8, 2025, Igor Korot <ikorot01(at)gmail(dot)com> wrote:
>
>
> However,, I'd like to still insert the record and I'd like to do something
> like:
>
> INSERT INTO test VALUES( 0, 'abc', 12345, IF( (SELECT foo FROM bar) ==
> NULL, "postgres", <select_result>), /*more data follow*/);
>
> What would be the best way to achieve this?
>

The “coalesce” function.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2025-12-09 02:51:55 Re: How do I check for NULL
Previous Message Igor Korot 2025-12-09 02:39:46 How do I check for NULL