Skip to content

Instantly share code, notes, and snippets.

-- Update goes into a CTE, the CTE will become the source of data to our insert into product_log
WITH logs AS (
UPDATE product
SET price = price * 1.1
, date_updated = NOW()
RETURNING product.id, product.price
)
INSERT INTO product_log (product_id, price)
SELECT id, price
FROM logs;
// https://processing.org/
float inc = 0.05;
float zinc = 0.0001;
int particleSize = 2;
int particleCount = 5000;
float pmod = 500; // particle mod for hue increment
float hincm = 0.1; // hue increment multiplier