Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-3801

SELECT... LIMIT 0 returns a row

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Cannot Reproduce
    • 1.4.2
    • Icebox
    • MariaDB Server
    • None

    Description

      Accidentally stumbled onto this while testing some machine-generated SQL with ColumnStore from X4.

      MariaDB [bookstore]> SELECT trans_date FROM `bookstore`.`transactions` LIMIT 0;
      ---------------------

      trans_date

      ---------------------

      2018-05-07 16:46:50

      ---------------------
      1 row in set (0.032 sec)

      As a comparison, with InnoDB:

      MariaDB [bookstore]> SELECT trans_date FROM `bookstore`.`Transactions` LIMIT 0;
      Empty set (0.000 sec)

      "SELECT * ... LIMIT 0" is used by the client software as a generic way to determine columns and datatypes. May not be super smart and a bit to the side of how we do things manually, but is generic and works with many databases.

      ColumnStore should respect the LIMIT 0 properly, because the same stanza can also be seen in "CREATE TABLE AS SELECT... LIMIT 0" (again, we would have probably written just "CREATE TABLE LIKE..." manually) - in whcih case we obviously don't want anything going into the newly created table. I have even seen MaxScale used to automatically append "LIMIT 0" to "CREATE TABLE AS SELECT" to prevent performance-sensitive setups (e.g., a Galera cluster) from being hosed for hours by such a query.

      Attachments

        Activity

          People

            Unassigned Unassigned
            assen.totin Assen Totin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.