Looking at the logs, I think the problem may be because the 2 columns I want to Coalesce have a different type in the database. They have the same "base" and "effective" types but have different types in the DB...
:error "ERROR: COALESCE could not convert type \"ScanType\" to \"ProductType\"\n Position: 610",
:row_count 0,
:running_time 0,
:preprocessed
{:type :query,
:query
{:source-table 71,
:fields
[[:field 9506 nil]
[:field 9540 nil]
[:field 9557 nil]
[:expression "normalized"]
[:field 9590 {:join-alias "TaskRequest"}]
[:field 9588 {:join-alias "TaskRequest"}]
[:field 9592 {:join-alias "TaskRequest"}]],
:expressions {"normalized" [:coalesce [:field 9592 {:join-alias "TaskRequest"}] [:field 9557 nil]]},
:filter
[:and
[:or
[:=
[:field 9557 nil]
[:value
"OSS"
{:base_type :type/PostgresEnum,
:effective_type :type/PostgresEnum,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "ScanType",
:name "scan_type"}]]
[:=
[:field 9557 nil]
[:value
"CBCT"
{:base_type :type/PostgresEnum,
:effective_type :type/PostgresEnum,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "ScanType",
:name "scan_type"}]]]
[:or
[:=
[:field 9592 {:join-alias "TaskRequest"}]
[:value
"OSS"
{:base_type :type/PostgresEnum,
:effective_type :type/PostgresEnum,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "ProductType",
:name "product_type"}]]
[:=
[:field 9592 {:join-alias "TaskRequest"}]
[:value
"CBCT"
{:base_type :type/PostgresEnum,
:effective_type :type/PostgresEnum,
:coercion_strategy nil,
:semantic_type :type/Category,
:database_type "ProductType",
:name "product_type"}]]]],
:limit 10,
:joins
[{:alias "TaskRequest",
:strategy :left-join,
:fields
[[:field 9590 {:join-alias "TaskRequest"}]
[:field 9588 {:join-alias "TaskRequest"}]
[:field 9592 {:join-alias "TaskRequest"}]],
:source-table 75,
:condition [:= [:field 9540 nil] [:field 9588 {:join-alias "TaskRequest"}]]}]},
:database 10,
:middleware {:js-int-to-string? true, :add-default-userland-constraints? true},
:info {:executed-by 2, :context :ad-hoc}},
:data {:rows [], :cols []}}