Yugabyte as backend for Orthanc function error

I opened [YSQL] unrecognized node type: 8388615 · Issue #23461 · yugabyte/yugabyte-db · GitHub

One workaround is adding an explicit ::bigint type case in the function:

CREATE OR REPLACE FUNCTION UpdateSingleStatistic(
    IN statistics_key INTEGER,
    OUT new_value BIGINT
) AS $body$
BEGIN
  -- Delete the current changes, sum them and update the GlobalIntegers row.
  -- New rows can be added in the meantime, they won't be deleted or summed.
  WITH deleted_rows AS (
      DELETE FROM GlobalIntegersChanges
      WHERE GlobalIntegersChanges.key = statistics_key
      RETURNING value
  )
  UPDATE GlobalIntegers
  SET value = value + (
      SELECT COALESCE(SUM(value)::bigint, 0)
      FROM deleted_rows
  )
  WHERE GlobalIntegers.key = statistics_key
  RETURNING value INTO new_value;
END;
$body$ LANGUAGE plpgsql;

or if you can’t, disable predicate pushdown

ALTER ROLE orthanc SET yb_enable_expression_pushdown =off;

(updated: it’s not distinct pushdown but expression pushdown)
but I prefer the workaround at the scope of the function.