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

The information of the table in INFORMATION_SCHEMA is inconsistent with the actual!

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Not a Bug
    • 10.0.20, 10.9.1
    • N/A
    • None
    • MariaDB Server version: 10.0.20-MariaDB
      MariaDB Server version: 10.9.1-MariaDB-1:10.9.1+maria~jammy

      OS :
      Linux 4.4.38-1.el7.elrepo.x86_64 #1 SMP Sat Dec 10 18:16:05 EST 2016 x86_64 x86_64 x86_64 GNU/Linux


    Description

      There is no primary key when the table is created, but INFORMATION_SCHEMA shows that there is a primary key.

      When querying, FORCE INDEX(`PRIMARY`) cannot be used!

      I want "INFORMATION_SCHEMA" and "FORCE INDEX" to be consistent!

      CREATE TABLE `test` (
        `id` int(10) NOT NULL AUTO_INCREMENT,
        `user` varchar(50) DEFAULT NULL,
        `create_time` timestamp NULL DEFAULT current_timestamp(),
       UNIQUE KEY `id` (`id`)
      ) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4;
       
      insert into test values(1, "tony", now());
      insert into test values(2, "jack", now());
       
      SELECT COLUMN_NAME, IS_NULLABLE, DATA_TYPE, COLUMN_KEY, EXTRA FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA="test" AND TABLE_NAME="test" ORDER BY ORDINAL_POSITION\G;
      *************************** 1. row ***************************
      COLUMN_NAME: id
      IS_NULLABLE: NO
        DATA_TYPE: int
      COLUMN_KEY: PRI
       EXTRA: auto_increment
      *************************** 2. row ***************************
      COLUMN_NAME: user
      IS_NULLABLE: YES
        DATA_TYPE: varchar
       COLUMN_KEY:
            EXTRA:
      *************************** 3. row ***************************
      COLUMN_NAME: create_time
      IS_NULLABLE: YES
        DATA_TYPE: timestamp
       COLUMN_KEY:
            EXTRA:
       
       
      MariaDB [test]> select id from test1  FORCE INDEX(`PRIMARY`)  where id=2;
      ERROR 1146 (42S02): Table 'test.test1' doesn't exist
       
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            feng19910104 fengwei
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.