Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vT1II-00BWH5-0K for pgsql-general@arkaria.postgresql.org; Tue, 09 Dec 2025 17:14:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vT1IG-005irE-2G for pgsql-general@arkaria.postgresql.org; Tue, 09 Dec 2025 17:14:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vT1IG-005ir6-11 for pgsql-general@lists.postgresql.org; Tue, 09 Dec 2025 17:14:32 +0000 Received: from sm-r-008-dus.org-dns.com ([84.19.1.236]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vT1IE-0044xU-0P for pgsql-general@lists.postgresql.org; Tue, 09 Dec 2025 17:14:32 +0000 Received: from smarthost-dus.org-dns.com (localhost [127.0.0.1]) by smarthost-dus.org-dns.com (Postfix) with ESMTP id 2764CA18A4 for ; Tue, 9 Dec 2025 18:14:29 +0100 (CET) Received: by smarthost-dus.org-dns.com (Postfix, from userid 1001) id 1B119A18E9; Tue, 9 Dec 2025 18:14:29 +0100 (CET) X-Spam-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,DMARC_PASS,HTML_MESSAGE,KAM_INFOUSMEBIZ,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 Received: from ha01s018.org-dns.com (ha01s018.org-dns.com [62.108.32.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smarthost-dus.org-dns.com (Postfix) with ESMTPS id C8329A18A4 for ; Tue, 9 Dec 2025 18:14:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gelassene-pferde.biz; s=default; t=1765300468; bh=gWtRZ+b2rJPvAFO1ZLikdFjpIEbq6ZzvgE80Oo/qZHE=; h=From:To:Subject; b=UHqZHcwy3dN9YdOIqySk5SNRxcBKv8UHVBckLX/qSiu3m034oE7egYvFzx5Qqj42w hQeiPtF6ZKNgyxxglO7TOJQ01EZaESgOFCRqdchTuSX/lgBYbzAsQl+vTy0inLZ2tm UoJgKhQSW1TGH1n2dNO5j9EN0ELTg9IBxy4M0tf8= Authentication-Results: ha01s018.org-dns.com; spf=pass (sender IP is 146.185.68.202) smtp.mailfrom=thiemo@gelassene-pferde.biz smtp.helo=dummy.faircode.eu Received-SPF: pass (ha01s018.org-dns.com: connection is authenticated) Date: Tue, 9 Dec 2025 18:14:27 +0100 (GMT+01:00) From: Thiemo Kellner To: pgsql-general@lists.postgresql.org Message-ID: In-Reply-To: References: Subject: How do I check for NULL MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5_156573769.1765300467734" X-Correlation-ID: X-PPP-Message-ID: <176530046865.64681.463212031649021904@ha01s018.org-dns.com> X-PPP-Vhost: gelassene-pferde.biz X-POWERED-BY: wint.global - AV:CLEAN SPAM:OK List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------=_Part_5_156573769.1765300467734 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi I believe there is a misconception. I feel, you meant to say, the subquery does not return any record which is not the same as returns NULL. In any case, I suggest you to use the "insert select" construct, see examples in https://www.postgresql.org/docs/current/sql-insert.html, e.g. "NSERT INTO films SELECT * FROM tmp_films WHERE date_prod < '2004-05-07';" Cheers Thiemo ------=_Part_5_156573769.1765300467734 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi

I believe there is a misconception. I feel, you meant to say, the subquery does not return any record which is not the same as returns NULL.

In any case, I suggest you to use the "insert select" construct, see examples in https://www.postgresql.org/docs/current/sql-insert.html, e.g. "NSERT INTO films SELECT * FROM tmp_films WHERE date_prod < '2004-05-07';"

Cheers

Thiemo

------=_Part_5_156573769.1765300467734--