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.94.2) (envelope-from ) id 1sOvqn-0022iP-Q9 for pgsql-docs@arkaria.postgresql.org; Wed, 03 Jul 2024 09:00:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sOvql-0079xO-IS for pgsql-docs@arkaria.postgresql.org; Wed, 03 Jul 2024 09:00:28 +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.94.2) (envelope-from ) id 1sOvqk-0079xG-AE for pgsql-docs@lists.postgresql.org; Wed, 03 Jul 2024 09:00:28 +0000 Received: from fout5-smtp.messagingengine.com ([103.168.172.148]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sOvqg-000Buo-82 for pgsql-docs@lists.postgresql.org; Wed, 03 Jul 2024 09:00:25 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfout.nyi.internal (Postfix) with ESMTP id D1A8113805FE; Wed, 3 Jul 2024 05:00:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 03 Jul 2024 05:00:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1719997219; x=1720083619; bh=eKLTeC0wJ85h7ywpOtV/lfW9qe6T0ZbsY8IujXK+TaQ=; b= Ts9rQoPntDFgNkOsccNshbaWe8hHVkxrNQUyjdT7ceFedq/lGIQEycvaU34XmDrw K2ywK6DiLGAtIHg09H37PMz+6EPpCjZ+W2RSttNZb3IbEBst6X/xCRmbmi5HDl+T hgxFmEDWZhCry6RAnAXOuZ2Udb1tQDbpIivGjTISXFXoKFwE2O3KFyI0FoJ/g83T dJ5U0b1ASReGlZPHKaw1wp03BIEoY8ag6dVDwBfuA1MiL6pbnBl+mwF0gOsyfIPg h13NbbSeiS/JgFAuk8136fDWksZfMbAy7IYgQVWOmK84f+UfIn0ykAMvRoxc7bRF Yban+Zd01RS7HXb51XW7FA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1719997219; x= 1720083619; bh=eKLTeC0wJ85h7ywpOtV/lfW9qe6T0ZbsY8IujXK+TaQ=; b=S SMS6nQ5fYOAOSN1TwPEY6MQ6h5QcEtAK5dihAXbS1EgLvFdJv9LQOHcYr2B4W10w PB5+lx0Z+qswzd9+UE0cXrSdxuOfAAts2V6OBoOC0PPJg+2Ip1WZhL/qaPRzw9CZ zRH0I78HheWd9MS4gDrDk4UH4YqTEdKY0rRnEr1C37T03zea0AzYcjbFgf0TbejQ mriHd8qXQ1E9tKb0/470yUIHOrcV/itV7hh5I8Q+qmbCuaDpf9V4oEiSKAMQVm+g eFlRZUbff5g6z5gDlR5PuHVZdFFOYPIdNpo90hexJ0a0RsKa1ywJnms9xjTCgUCH whe1VVAe2/OIcankZH4YA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudejgdduudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthekre dttddvjeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhes vghishgvnhhtrhgruhhtrdhorhhgqeenucggtffrrghtthgvrhhnpefhheejjeeifffgve fhjeduhffhjeeugfduheffkeevhfegjeeuhfdvteeiueffteenucffohhmrghinhepphho shhtghhrvghsqhhlrdhorhhgpdhsthgrtghkohhvvghrfhhlohifrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhesvghi shgvnhhtrhgruhhtrdhorhhg X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Jul 2024 05:00:18 -0400 (EDT) Message-ID: <62f888dc-1ee5-48cf-b76c-6a75dcfa8b10@eisentraut.org> Date: Wed, 3 Jul 2024 11:00:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: COALESCE documentation To: =?UTF-8?B?TmF2csOhdGlsLCBPbmTFmWVq?= , pgsql-docs@lists.postgresql.org References: Content-Language: en-US From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 02.07.24 12:45, Navrátil, Ondřej wrote: > Hello, > > as per documentation > > > The |COALESCE| function returns the first of its arguments that is > not null. Null is returned only if all arguments are null. > > This is not exactly true. In fact: > The |COALESCE| function returns the first of its arguments that *is > distinct* *from *null. Null is returned only if all arguments *are not > distinct from* null. > > See my stack overflow question here > . > > Long story short > > |select coalesce((null, null), (10, 20)) as magic; | > > returns > > |magic ------- (,) (1 row)| > > However, this is true: > > |select (null, null) is null;| I think this is actually a bug in the implementation, not in the documentation. That is, the implementation should behave like the documentation suggests.