CREATE TABLE IF NOT EXISTS GlobalIntegers(
key INTEGER PRIMARY KEY,
value BIGINT);
CREATE TABLE IF NOT EXISTS GlobalIntegersChanges(
key INTEGER,
value BIGINT);
WITH deleted_rows AS (
DELETE FROM GlobalIntegersChanges
WHERE GlobalIntegersChanges.key = 0
RETURNING value
)
UPDATE GlobalIntegers
SET value = value + (
SELECT COALESCE(SUM(value), 0)
FROM deleted_rows
)
WHERE GlobalIntegers.key = 0
;
Jira Link: DB-12381
Description
Error encountered in orthanc reported on forum:
fails with:
The plan is:
Two ways to workaround:
cast from numeric (result of
sum()
) to bigint The plan is:disable pushdowns with
set yb_enable_expression_pushdown to off;
The plan is:Issue Type
kind/bug
Warning: Please confirm that this issue does not contain any sensitive information