From 4963e137a792727554e175f7de668124e2d741d3 Mon Sep 17 00:00:00 2001 From: schneefux Date: Fri, 12 Jan 2018 21:22:30 +0100 Subject: fix Maria 10.2 returning null instead of 0 for nonexistant json attrs --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index 9a5ce47..f3995a6 100644 --- a/worker.js +++ b/worker.js @@ -92,7 +92,7 @@ amqp.connect(RABBITMQ_URI).then(async (rabbit) => { const pad = (i) => i.toString().padStart(3, "0"); if (doCreate) { // insert return active_items.map((i) => - `sum(column_get(${tableName}.item_uses, '${i}' as int)) ` + + `sum(coalesce(column_get(${tableName}.item_uses, '${i}' as int), 0)) ` + `as item_${pad(i)}_use` ).join(",\n"); } else { -- cgit v1.3.1