-- Test that ISOK_RESULTS rows are updated with new QR_Message and -- QR_Extra values. BEGIN; -- Run once to populate ISOK_RESULTS SELECT irid, iqname, qr_id, qr_message, qr_extra FROM run_isok_queries($$VALUES ('query1');$$) ORDER BY irid; irid | iqname | qr_id | qr_message | qr_extra ------+--------+-------+-----------------+---------- 1 | query1 | R1 | Result number 1 | 2 | query1 | R2 | Result number 2 | 3 | query1 | R3 | Result number 3 | (3 rows) -- Update the query to change the message and results UPDATE isok_queries SET query = $$VALUES ('R1', 'New result number 1', '[]') , ('R2', 'New result number 2', '[]') , ('R3', 'New result number 3', '[]');$$ WHERE iqname = 'query1'; -- Run again to update ISOK_RESULTS -- See the new results SELECT irid, iqname, qr_id, qr_message, qr_extra FROM run_isok_queries($$VALUES ('query1');$$) ORDER BY irid; irid | iqname | qr_id | qr_message | qr_extra ------+--------+-------+---------------------+---------- 1 | query1 | R1 | New result number 1 | [] 2 | query1 | R2 | New result number 2 | [] 3 | query1 | R3 | New result number 3 | [] (3 rows) ROLLBACK; -- Cleanup -- Reset the sequence so what this test did is ignored. SELECT setval('isok_results_irid_seq', 1, FALSE); setval -------- 1 (1 row)