-- Fail to UPDATE ISOK_RESULTS to resolve the issue when the ISOK_QUERIES
-- is an error

-- Insert a new error result
INSERT INTO isok_results (
    -- The irid is generated from a sequence
    iqname, first_seen, last_seen, last_role, last_schemas
  , resolved, deferred_to, type, keep_until
  , qr_id, qr_message, qr_extra
  , notes)
  VALUES ('errorquery2'
        , '1900-01-01'
        , '1900-01-01'
        , 'somerole'
        , '{"schema1","schema2"}'

        , NULL
        , NULL
        , 'rtype1'
        , NULL

        , 'testresult2'
        , 'Informative message'
        , NULL

        , '');

-- Update the result, attempting to resolve it
UPDATE isok_results
  SET resolved = last_seen
  WHERE irid = lastval();
