Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1klaHc-0000iI-SC for psycopg@arkaria.postgresql.org; Sat, 05 Dec 2020 16:19:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1klaHb-00063w-Rx for psycopg@arkaria.postgresql.org; Sat, 05 Dec 2020 16:19:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1klaHb-00063p-Mf for psycopg@lists.postgresql.org; Sat, 05 Dec 2020 16:19:39 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1klaHY-00012q-Sq for psycopg@lists.postgresql.org; Sat, 05 Dec 2020 16:19:39 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 5D413601; Sat, 5 Dec 2020 11:19:34 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 05 Dec 2020 11:19:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=2 y32prgTETA/W6uln7ieNYWz0PUlGvYwff54Lg2hOx0=; b=Z+CSB6K4Xoy6nkNSK PT+SHJ4O24C1+QzG4w1vugC+GBFjvxCBsJf3l7Rm+lWiohp/OCg1MIwvV6puiEuJ 7BTt2EcFw35796k62g1Cfkr3rYn7lWrMPs/+dJVN+hlmlGLbBhG0GOraDvNI6quK cDk1pkpacVm64mvfGk1vQgnjv0MSxxsCwjRiHco8803i50skDALVKEyaAnjmHJNm x3W8ZCU0ZidS3oFh1lymOFiBUMnJrIvKFNCZcPqr0UifFFGYYJ778jNx+QjXlKix WvXc6AMerwLlNjT+9g12CPdz8bN0DKyAfoQS+/cFk4PFkmLFQXk2So6Rv6qJGMNv S7yNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=2y32prgTETA/W6uln7ieNYWz0PUlGvYwff54Lg2hO x0=; b=WzBdxmo9td+CRFXjh3EiyjgCV8efV3kvnRcCYGfFmL7ydCRmNOH9axz8H P4SVMskxz27rDYJ/ESuOR2Ocp2WsAycoFrXTAh9tADwjGVVR5K6V+1Cl2uBsB0Um MrYdkfuHmWUE4XXUVgH6uALDtBaBaZQgekplyEZJAPyouUr9BOFS3ZYTr+42ROVz JHPd0Dt+JMbqEWXYVePRy6P8uGD0k0tkoYg4zGaFlj/Afssxv6wp1VGbcEb9JkEl jthClAoKif2JuekOZGU9VkHUu8pl6y5mUELN6tOqSeCkP5Exil8L5MT/iwQg43+m kdeyOCFHu8/8vnIbJOs71iNE5Doeg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudejtddgkeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepveetjedtie ekteefhffhhfetledvkeffvedugeejueekhffgvdeileeitdekvefhnecuffhomhgrihhn pehpohhsthhgrhgvshhqlhdrohhrghenucfkphepjeehrddujedvrddurdeileenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.4] (75-172-1-69.tukw.qwest.net [75.172.1.69]) by mail.messagingengine.com (Postfix) with ESMTPA id E0630240059; Sat, 5 Dec 2020 11:19:32 -0500 (EST) Subject: Re: Handling (None,) Query Results To: hagen@datasundae.com, psycopg@lists.postgresql.org, psycopg@postgresql.org References: <5f75fbb2-6da2-60f3-5488-9013d1328361@datasundae.com> <80505104-1778-6157-cb9f-8cbafb748660@aklaver.com> <067801d6cb21$c6b442f0$541cc8d0$@datasundae.com> From: Adrian Klaver Message-ID: <63e5c526-7e07-ad4b-f891-ac5272257507@aklaver.com> Date: Sat, 5 Dec 2020 08:19:32 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <067801d6cb21$c6b442f0$541cc8d0$@datasundae.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/5/20 8:14 AM, hagen@datasundae.com wrote: > I tried the COALESCE approach but I thought the query still returned (None,). From docs: https://www.postgresql.org/docs/12/functions-conditional.html#FUNCTIONS-COALESCE-NVL-IFNULL "The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are null. ..." So if it returned NULL/None then the first and second values both resolved to NULL. > > However, I just tried it again and I got a (Decimal('0'),) return. > > I should be able to make that work. > > Thanks everyone for your rapid assistance. > > Best, > > Hagen > -- Adrian Klaver adrian.klaver@aklaver.com