Re: Handling (None,) Query Results - Mailing list psycopg

From Adrian Klaver
Subject Re: Handling (None,) Query Results
Date
Msg-id 63e5c526-7e07-ad4b-f891-ac5272257507@aklaver.com
Whole thread Raw
In response to RE: Handling (None,) Query Results  (<hagen@datasundae.com>)
List psycopg
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



psycopg by date:

Previous
From:
Date:
Subject: RE: Handling (None,) Query Results
Next
From:
Date:
Subject: Inserting variable into