Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-39946

CREATE VIEW silently drops /*+ MAX_EXECUTION_TIME(...) */ so timeout not applied

    XMLWordPrintable

Details

    Description

      Summary

      On MariaDB 12.3.1-MariaDB-asan-log (rev 21a0714a), query-level hint MAX_EXECUTION_TIME inside a CREATE VIEW is not preserved and not enforced at runtime. Direct SELECT with the same hint is enforced, but SELECT via the view completes without timeout. Other hints (NO_INDEX, INDEX, JOIN_ORDER, BKA) are preserved in views.

      Minimal Reproducer

      CREATE TABLE t (a INT);
      INSERT INTO t VALUES (1);
       
      CREATE VIEW v AS
        SELECT /*+ MAX_EXECUTION_TIME(1) */ SLEEP(0.05) AS s, a FROM t;
       
      SHOW CREATE VIEW v;
      -- → no MAX_EXECUTION_TIME in view text
       
      -- Direct: timeout enforced
      SELECT /*+ MAX_EXECUTION_TIME(1) */ SLEEP(0.05) AS s FROM t;
      -- → ERROR 1969
       
      -- Via view: succeeds (hint lost)
      SELECT s FROM v;
      -- → 0
      

      Expected

      MAX_EXECUTION_TIME hint should be preserved in the view definition and applied when selecting from the view, resulting in ERROR 1969 for the same timeout.

      Actual

      Hint is dropped in CREATE VIEW. SELECT from the view completes successfully; no timeout.

      Workarounds / Controls

      Other hints (NO_INDEX, INDEX, JOIN_ORDER, BKA, SEMIJOIN) are preserved and enforced in views. Only query-level hints like MAX_EXECUTION_TIME and SET_VAR appear stripped.

      Suggested Fix

      Preserve MAX_EXECUTION_TIME in CREATE VIEW and enforce it at SELECT resolution, similar to direct-query hint handling in Max_execution_time_hint::resolve().

      Environment

      Item Value
      Version 12.3.1-MariaDB-asan-log
      Revision 21a0714a118614982d20bfa504763d7247800091

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            mu mu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.