-- Fail to UPDATE an ISOK_QUERIES to an error when there is a
-- resolved ISOK_RESULTS row

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

        , '1900-01-01'
        , NULL
        , 'rtype1'
        , NULL

        , 'testresult3'
        , 'Informative message'
        , NULL

        , '');

-- Change the query from a warning to an error
UPDATE isok_queries
  SET error = TRUE
  WHERE iqname = 'query1';
