Skip to content

[YSQL][SQLsmith] ERROR: Illegal state: Transaction for catalog table write operation 'sql_features' not found #11221

@def-

Description

@def-

Jira Link: DB-967

Description

Happens in updates, might be a duplicate of #10087, also found with SQLsmith. Similar issue was #9645 previously, but that's been closed already.

CREATE TABLE mvtest_t (id int NOT NULL PRIMARY KEY, type text NOT NULL, amt numeric NOT NULL);
INSERT INTO mvtest_t VALUES
  (1, 'x', 2),
  (2, 'x', 3),
  (3, 'y', 5),
  (4, 'y', 7),
  (5, 'z', 11);
CREATE VIEW mvtest_tv AS SELECT type, sum(amt) AS totamt FROM mvtest_t GROUP BY type;
CREATE TABLE mvtest_boxes (id serial primary key, b box);
INSERT INTO mvtest_boxes (b) VALUES
  ('(32,32),(31,31)'),
  ('(2.0000004,2.0000004),(1,1)'),
  ('(1.9999996,1.9999996),(1,1)');

update information_schema.sql_features set 
  feature_name = case when (select utc_offset from pg_catalog.pg_timezone_abbrevs limit 1 offset 5)
         >= (select write_lag from pg_catalog.pg_stat_replication limit 1 offset 56)
         then information_schema.sql_features.sub_feature_name else information_schema.sql_features.sub_feature_name end
    , 
  sub_feature_id = (select feature_id from information_schema.sql_parts limit 1 offset 1)
    , 
  sub_feature_name = case when case when cast(null as lseg) @ (select b from public.mvtest_boxes limit 1 offset 6)
             then (select totamt from public.mvtest_tv limit 1 offset 5)
           else (select totamt from public.mvtest_tv limit 1 offset 5)
           end
         >= case when case when ((select b from public.mvtest_boxes limit 1 offset 2)
                   |>> cast(null as box)) 
              and (false) then cast(null as tsvector) else cast(null as tsvector) end
             @@@ cast(null as tsquery) then (select pg_catalog.var_pop(amopstrategy) from pg_catalog.pg_amop)
           else (select pg_catalog.var_pop(amopstrategy) from pg_catalog.pg_amop)
           end
         then information_schema.sql_features.feature_id else information_schema.sql_features.feature_id end
    , 
  is_verified_by = information_schema.sql_features.feature_name, 
  comments = information_schema.sql_features.feature_id
returning 
  information_schema.sql_features.feature_name as c0, 
  information_schema.sql_features.feature_name as c1, 
  information_schema.sql_features.feature_name as c2, 
  (select mapseqno from pg_catalog.pg_ts_config_map limit 1 offset 2)
     as c3, 
  information_schema.sql_features.is_supported as c4, 
  information_schema.sql_features.comments as c5, 
  information_schema.sql_features.is_verified_by as c6;

Fails with:

ERROR:  Illegal state: Transaction for catalog table write operation 'sql_features' not found

If this is expected, I guess the error message should at least be adapted not to say "Illegal state", which sounds like a bug.

Metadata

Metadata

Assignees

Labels

area/ysqlYugabyte SQL (YSQL)kind/bugThis issue is a bugkind/failing-testTests and testing infrapriority/mediumMedium priority issueqa_automationBugs identified via itest-system, LST, Stress automation or causing automation failures

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions