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

Add views for periods in information_schema

Details

    Description

      System-versioned tables can be recognized in information_schema by TABLES.TABLE_TYPE being SYSTEM VERSIONED. Application-time period tables, however, are indistinguishable. They present in TABLES view as BASE TABLE, and the period looks like a regular check constraint both in CHECK_CONSTRAINTS and TABLE_CONSTRAINTS. As discussed earlier on Slack, the standard defines some period-specific views, I think at least most basic ones should be added.

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            serg Sergei Golubchik made changes -
            Field Original Value New Value
            Assignee Sergei Golubchik [ serg ] Nikita Malyavin [ nikitamalyavin ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.6 [ 24028 ]
            serg Sergei Golubchik made changes -
            Rank Ranked higher
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.7 [ 24805 ]
            Fix Version/s 10.6 [ 24028 ]
            serg Sergei Golubchik made changes -
            Labels beginner-friendly
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.8 [ 26121 ]
            Fix Version/s 10.7 [ 24805 ]
            serg Sergei Golubchik made changes -
            Description System-versioned tables can be recognized in information_schema by {{TABLES.TABLE_TYPE}} {{SYSTEM VERSIONED}}. Application-time period tables, however, are indistinguishable. They present in {{TABLES}} view as {{BASE TABLE}}, and the period looks like a regular check constraint both in {{CHECK_CONSTRAINTS}} and {{TABLE_CONSTRAINTS}}. As discussed earlier on Slack, the standard defines some period-specific views, I think at least most basic ones should be added. System-versioned tables can be recognized in information_schema by {{TABLES.TABLE_TYPE}} being {{SYSTEM VERSIONED}}. Application-time period tables, however, are indistinguishable. They present in {{TABLES}} view as {{BASE TABLE}}, and the period looks like a regular check constraint both in {{CHECK_CONSTRAINTS}} and {{TABLE_CONSTRAINTS}}. As discussed earlier on Slack, the standard defines some period-specific views, I think at least most basic ones should be added.
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 108804 ] MariaDB v4 [ 131294 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.9 [ 26905 ]
            Fix Version/s 10.8 [ 26121 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.10 [ 27530 ]
            Fix Version/s 10.9 [ 26905 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.11 [ 27614 ]
            Fix Version/s 10.10 [ 27530 ]
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            AirFocus AirFocus made changes -
            Description System-versioned tables can be recognized in information_schema by {{TABLES.TABLE_TYPE}} being {{SYSTEM VERSIONED}}. Application-time period tables, however, are indistinguishable. They present in {{TABLES}} view as {{BASE TABLE}}, and the period looks like a regular check constraint both in {{CHECK_CONSTRAINTS}} and {{TABLE_CONSTRAINTS}}. As discussed earlier on Slack, the standard defines some period-specific views, I think at least most basic ones should be added. System-versioned tables can be recognized in information\_schema by {{TABLES.TABLE_TYPE}} being {{SYSTEM VERSIONED}}. Application-time period tables, however, are indistinguishable. They present in {{TABLES}} view as {{BASE TABLE}}, and the period looks like a regular check constraint both in {{CHECK_CONSTRAINTS}} and {{TABLE_CONSTRAINTS}}. As discussed earlier on Slack, the standard defines some period\-specific views, I think at least most basic ones should be added.
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.12 [ 28320 ]
            Fix Version/s 10.11 [ 27614 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 11.2 [ 28603 ]
            Fix Version/s 11.0 [ 28320 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 11.3 [ 28565 ]
            Fix Version/s 11.2 [ 28603 ]
            nikitamalyavin Nikita Malyavin made changes -
            Status Open [ 1 ] In Progress [ 3 ]

            The standard introduces a new table PERIODS. TABLE_TYPE will not be affected.

            nikitamalyavin Nikita Malyavin added a comment - The standard introduces a new table PERIODS. TABLE_TYPE will not be affected.
            serg Sergei Golubchik added a comment - - edited

            Full list of what periods affect in I_S:

            • PERIODS view
              • columns TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, PERIOD_NAME, START_COLUMN_NAME (NULL if the user has no privileges to see it), END_COLUMN_NAME
              • we'll do it. should show application-time periods and by system time.
            • COLUMNS view has columns: IS_SYSTEM_TIME_PERIOD_START, IS_SYSTEM_TIME_PERIOD_END, SYSTEM_TIME_PERIOD_TIMESTAMP_GENERATION
              • we'll do the first two, but not SYSTEM_TIME_PERIOD_TIMESTAMP_GENERATION
            • CONSTRAINT_PERIOD_USAGE
              • we can have part of it (can show UNIQUE, but not FOREIGN KEY and CHECK constraints), but it doesn't make a lot of sense to have partially implemented table, and unique keys will be seen in the next table
              • so we won't have it
            • KEY_PERIOD_USAGE
              • columns CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME,
                TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, PERIOD_NAME
              • we'll do it
            • ROUTINE_PERIOD_USAGE, TRIGGER_PERIOD_USAGE, VIEW_PERIOD_USAGE
              • we cannot have it
            serg Sergei Golubchik added a comment - - edited Full list of what periods affect in I_S: PERIODS view columns TABLE_CATALOG , TABLE_SCHEMA , TABLE_NAME , PERIOD_NAME , START_COLUMN_NAME ( NULL if the user has no privileges to see it), END_COLUMN_NAME we'll do it. should show application-time periods and by system time. COLUMNS view has columns: IS_SYSTEM_TIME_PERIOD_START, IS_SYSTEM_TIME_PERIOD_END, SYSTEM_TIME_PERIOD_TIMESTAMP_GENERATION we'll do the first two, but not SYSTEM_TIME_PERIOD_TIMESTAMP_GENERATION CONSTRAINT_PERIOD_USAGE we can have part of it (can show UNIQUE, but not FOREIGN KEY and CHECK constraints), but it doesn't make a lot of sense to have partially implemented table, and unique keys will be seen in the next table so we won't have it KEY_PERIOD_USAGE columns CONSTRAINT_CATALOG , CONSTRAINT_SCHEMA , CONSTRAINT_NAME , TABLE_CATALOG , TABLE_SCHEMA , TABLE_NAME , PERIOD_NAME we'll do it ROUTINE_PERIOD_USAGE , TRIGGER_PERIOD_USAGE , VIEW_PERIOD_USAGE we cannot have it

            Please review commits:

            82a49812 MDEV-22597 Add views for periods in information_schema
            23b15d24 cleanup: add Field::store_yesno
            

            on branch bb-11.3-periods-schema

            nikitamalyavin Nikita Malyavin added a comment - Please review commits: 82a49812 MDEV-22597 Add views for periods in information_schema 23b15d24 cleanup: add Field::store_yesno on branch bb-11.3-periods-schema
            nikitamalyavin Nikita Malyavin made changes -
            Assignee Nikita Malyavin [ nikitamalyavin ] Sergei Golubchik [ serg ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Nikita Malyavin [ nikitamalyavin ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            nikitamalyavin Nikita Malyavin made changes -
            Assignee Nikita Malyavin [ nikitamalyavin ] Sergei Golubchik [ serg ]
            Status Stalled [ 10000 ] In Review [ 10002 ]

            82a49812 and 23b15d24 are ok to push

            would be good to add a test that

            create table t1 (a int) with system versioning

            does not show anything in the period tables.

            serg Sergei Golubchik added a comment - 82a49812 and 23b15d24 are ok to push would be good to add a test that create table t1 (a int ) with system versioning does not show anything in the period tables.
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Nikita Malyavin [ nikitamalyavin ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            elenst Elena Stepanova made changes -
            Status Stalled [ 10000 ] In Testing [ 10301 ]
            elenst Elena Stepanova made changes -
            Assignee Nikita Malyavin [ nikitamalyavin ] Elena Stepanova [ elenst ]
            alice Alice Sherepa made changes -
            elenst Elena Stepanova made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            Labels beginner-friendly Preview_11.3 beginner-friendly
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -

            Most testing was done so far on bb-11.3-periods-schema commits 24018c74 and 90656c9f. Some changes from commits 27839d43 and 44f64348 also taken into account.

            Must analyze

            • MDEV-32501 Information schema views for periods reveal information to unprivileged user
            • MDEV-32503 Queries from I_S.KEY_PERIOD_USAGE do not obey case-sensitivity
            • MDEV-32504 Search by I_S.KEY_PERIOD_USAGE.CONSTRAINT_NAME does not work

            It is "must analyze" but not necessarily "must fix" because it's possible that some or all of these problems are generic for information schema, not specific to the views added by this patch. If so, the priority can be decreased, although my recommendation would be to try to fix them by the GA.

            Suggestions
            MTR coverage lacks this line:

            ===File sql/sql_class.cc:
               6871 : +        bool is_update= MY_TEST(sql_command_flags() & CF_UPDATES_DATA);
            

            To my understanding, it is not a part of the feature as such, but of a preceding commit in the feature tree. Still, it would be good to fill the gap. Something like this does the trick, although of course it is not worth a separate test file, it should be added to an existing one instead:

            --source include/have_binlog_format_row.inc
            --source include/have_blackhole.inc
             
            CREATE TABLE t1(a INT) ENGINE=BLACKHOLE;
            UPDATE t1 SET a = a + 1;
            DROP TABLE t1;
            

            After the branch is ready, a final round of testing should be performed (even if no changes are made, because the previous testing was done on a mix of commits and its results may lack consistency).

            elenst Elena Stepanova added a comment - Most testing was done so far on bb-11.3-periods-schema commits 24018c74 and 90656c9f . Some changes from commits 27839d43 and 44f64348 also taken into account. Must analyze MDEV-32501 Information schema views for periods reveal information to unprivileged user MDEV-32503 Queries from I_S.KEY_PERIOD_USAGE do not obey case-sensitivity MDEV-32504 Search by I_S.KEY_PERIOD_USAGE.CONSTRAINT_NAME does not work It is "must analyze" but not necessarily "must fix" because it's possible that some or all of these problems are generic for information schema, not specific to the views added by this patch. If so, the priority can be decreased, although my recommendation would be to try to fix them by the GA. Suggestions MTR coverage lacks this line: ===File sql/sql_class.cc: 6871 : + bool is_update= MY_TEST(sql_command_flags() & CF_UPDATES_DATA); To my understanding, it is not a part of the feature as such, but of a preceding commit in the feature tree. Still, it would be good to fill the gap. Something like this does the trick, although of course it is not worth a separate test file, it should be added to an existing one instead: --source include/have_binlog_format_row.inc --source include/have_blackhole.inc   CREATE TABLE t1(a INT) ENGINE=BLACKHOLE; UPDATE t1 SET a = a + 1; DROP TABLE t1; After the branch is ready, a final round of testing should be performed (even if no changes are made, because the previous testing was done on a mix of commits and its results may lack consistency).
            elenst Elena Stepanova made changes -
            Assignee Elena Stepanova [ elenst ] Nikita Malyavin [ nikitamalyavin ]
            Status In Testing [ 10301 ] Stalled [ 10000 ]
            nikitamalyavin Nikita Malyavin made changes -
            Status Stalled [ 10000 ] In Testing [ 10301 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 11.4 [ 29301 ]
            Fix Version/s 11.3 [ 28565 ]
            julien.fritsch Julien Fritsch made changes -
            Issue Type Task [ 3 ] New Feature [ 2 ]
            alice Alice Sherepa made changes -
            Assignee Nikita Malyavin [ nikitamalyavin ] Alice Sherepa [ alice ]
            alice Alice Sherepa added a comment -

            Testing is done, bb-11.3-periods-schema 29f5901c8a95ece33d. Ok to push into 11.4

            alice Alice Sherepa added a comment - Testing is done, bb-11.3-periods-schema 29f5901c8a95ece33d. Ok to push into 11.4
            alice Alice Sherepa made changes -
            Assignee Alice Sherepa [ alice ] Nikita Malyavin [ nikitamalyavin ]
            alice Alice Sherepa made changes -
            Status In Testing [ 10301 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 11.4.1 [ 29523 ]
            Fix Version/s 11.4 [ 29301 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            greenman Ian Gilfillan added a comment -

            Please link to the Slack discussion or anywhere else relevant so I can see what these additions are supposed to do.

            greenman Ian Gilfillan added a comment - Please link to the Slack discussion or anywhere else relevant so I can see what these additions are supposed to do.

            greenman The best link I have is this Serg's comment, according to which it has been implemented.

            Also regarding the privilege rules see this comment in MDEV-32501.

            nikitamalyavin Nikita Malyavin added a comment - greenman The best link I have is this Serg's comment , according to which it has been implemented. Also regarding the privilege rules see this comment in MDEV-32501 .

            People

              nikitamalyavin Nikita Malyavin
              elenst Elena Stepanova
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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