-- The resolved results are updated, even when not output. -- Check Last_Schemas -- But this can't test for the update of Last_Seen. BEGIN; -- Run query1 for the first time to get results -- But don't show timestamps 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) -- Save the results so we can compare them later -- because we can't "display" the timestamps because -- that will show up as a test failure. CREATE TEMP TABLE _saved_results AS SELECT * FROM isok_results; -- Update the warnings so they are resolved. UPDATE isok_results SET resolved = first_seen WHERE iqname = 'query1'; -- Update the query so that it sets a new search path UPDATE isok_queries SET search_path = 'pg_catalog,public,test_schema' WHERE iqname = 'query1'; -- Create the schema CREATE SCHEMA test_schema; -- Examine what happens when we run again. -- We should see no output 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 ------+--------+-------+------------+---------- (0 rows) -- But there should be updated values in ISOK_RESULTS -- Display something if the values have not changed -- This should produce no rows. SELECT * FROM isok_results JOIN _saved_results ON (_saved_results.irid = isok_results.irid) WHERE _saved_results.last_schemas = isok_results.last_schemas; irid | iqname | first_seen | last_seen | last_role | last_schemas | resolved | deferred_to | category | keep_until | qr_id | qr_message | qr_extra | notes | irid | iqname | first_seen | last_seen | last_role | last_schemas | resolved | deferred_to | category | keep_until | qr_id | qr_message | qr_extra | notes ------+--------+------------+-----------+-----------+--------------+----------+-------------+----------+------------+-------+------------+----------+-------+------+--------+------------+-----------+-----------+--------------+----------+-------------+----------+------------+-------+------------+----------+------- (0 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)