I've got the following table (nodes) in a PostgreSQL DB and I'm looking to extract either the http OR https information. I am using COALESCE.
SELECT COALESCE(http,https)
FROM oig.nodes
WHERE owner_name = %s
AND node_type = COALESCE('full','api')
|---------------------|------------------|------------------|------------------|
| owner | node_type | http | https |
|---------------------|------------------|------------------|------------------|
| test123 | full | http://1.1.1.1 | |
|---------------------|------------------|------------------|------------------|
| testabc | api | | http://1.1.1.2 |
|---------------------|------------------|------------------|------------------|
| testabc | seed | | |
|---------------------|------------------|------------------|------------------|
This works, but only if the node_type = full, if the node_type = api, it returns None.
NULLs not empty '' string''). Trynullif(http_node_url, '')