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

CONNECT can't perform ORDER BY queries on some long columns

    XMLWordPrintable

Details

    Description

      CONNECT returns the following error when performing ORDER BY queries on some longer columns:

      MariaDB [tmp]> SELECT * FROM long_column_test ORDER BY col1;
      ERROR 1032 (HY000): Can't find record in 'long_column_test'

      For example, I'll create a table on MS SQL Server and insert some data:

      [gmontee@localhost ~]$ isql connect_test_azure connect_test 'Password1'
      +---------------------------------------+
      | Connected!                            |
      |                                       |
      | sql-statement                         |
      | help [tablename]                      |
      | quit                                  |
      |                                       |
      +---------------------------------------+
      SQL> CREATE TABLE dbo.long_column_test ( id int primary key, col1 varchar(510) );
      SQLRowCount returns -1
      SQL> INSERT INTO dbo.long_column_test VALUES(1, 'a');
      SQLRowCount returns 1
      SQL> SELECT * FROM dbo.long_column_test;
      +------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | id         | col1                                                                                                                                                                                                                                                                                                        |
      +------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | 1          | a                                                                                                                                                                                                                                                                                                           |
      +------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      SQLRowCount returns 1
      1 rows fetched
      SQL> quit

      Then I'll create the CONNECT table:

      [gmontee@localhost ~]$ mysql -u root tmp
      Reading table information for completion of table and column names
      You can turn off this feature to get a quicker startup with -A
       
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 35
      Server version: 10.0.15-MariaDB-log MariaDB Server
       
      Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [tmp]> CREATE TABLE long_column_test
          -> ENGINE=CONNECT
          -> TABLE_TYPE=ODBC
          -> TABNAME='dbo.long_column_test'
          -> CONNECTION='DSN=connect_test_azure;UID=connect_test;PWD=Password1';
      Query OK, 0 rows affected (2.41 sec)
       
      MariaDB [tmp]> SHOW CREATE TABLE long_column_test;
      +------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table            | Create Table                                                                                                                                                                                                                                                  |
      +------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | long_column_test | CREATE TABLE `long_column_test` (
        `id` int(10) NOT NULL,
        `col1` varchar(510) DEFAULT NULL
      ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=connect_test_azure;UID=connect_test;PWD=Password1' `TABLE_TYPE`='ODBC' `TABNAME`='dbo.long_column_test' |
      +------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)

      And then I'll try to query it. Some queries succeed, while others fail:

      MariaDB [tmp]> SELECT * FROM long_column_test ORDER BY col1;
      ERROR 1032 (HY000): Can't find record in 'long_column_test'
      MariaDB [tmp]> SELECT * FROM long_column_test;
      +----+------+
      | id | col1 |
      +----+------+
      |  1 | a    |
      +----+------+
      1 row in set (0.35 sec)
       
      MariaDB [tmp]> SELECT * FROM long_column_test ORDER BY id;
      +----+------+
      | id | col1 |
      +----+------+
      |  1 | a    |
      +----+------+
      1 row in set (4.84 sec)
       
      MariaDB [tmp]> SELECT * FROM long_column_test ORDER BY id, col1;
      ERROR 1032 (HY000): Can't find record in 'long_column_test'
      MariaDB [tmp]> SELECT * FROM long_column_test ORDER BY col1, id;
      ERROR 1032 (HY000): Can't find record in 'long_column_test'

      Attachments

        Activity

          People

            bertrandop Olivier Bertrand
            GeoffMontee Geoff Montee (Inactive)
            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.