Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create MaterializeMySQL cause clickhouse server Segmentation fault #16372

Closed
lostsnow opened this issue Oct 26, 2020 · 7 comments · Fixed by #18211
Closed

Create MaterializeMySQL cause clickhouse server Segmentation fault #16372

lostsnow opened this issue Oct 26, 2020 · 7 comments · Fixed by #18211
Assignees
Labels
bug Confirmed user-visible misbehaviour in official release comp-mysql crash Crash / segfault / abort

Comments

@lostsnow
Copy link

(you don't have to strictly follow this form)

Describe the bug

After create database with engine MaterializeMySQL, clickhouse server Segmentation fault and restart

How to reproduce

  • 20.10.2.20 (official build)
  • CREATE DATABASE xxx ENGINE = MaterializeMySQL('host', 'dbname', 'user', 'pass');

Error message and/or stacktrace

2020.10.26 10:56:31.340735 [ 18476 ] {} <Fatal> BaseDaemon: ########################################
2020.10.26 10:56:31.340793 [ 18476 ] {} <Fatal> BaseDaemon: (version 20.10.2.20 (official build), build id: FFE5E11E2023F86A) (from thread 1298) (no query) Received signal Segmentation fault (11)
2020.10.26 10:56:31.340818 [ 18476 ] {} <Fatal> BaseDaemon: Address: 0xfffffffffb0f8320 Access: write. Address not mapped to object.
2020.10.26 10:56:31.340840 [ 18476 ] {} <Fatal> BaseDaemon: Stack trace: 0xdef5e7e 0xdeeaeec 0xdb5214c 0xdb511d7 0xdecaff8 0xdec9e9d 0xdb00ba4 0xdb16b98 0xdb1c79e 0xdb1cc91 0xdafa7a9 0xdaf9e2a 0xdb162cd 0x7b8b75d 0x7b8f273 0x7fb9096a12de 0x7fb908fc5133
2020.10.26 10:56:31.340923 [ 18476 ] {} <Fatal> BaseDaemon: 2. std::__1::enable_if<(__is_cpp17_forward_iterator<std::__1::__wrap_iter<std::__1::shared_ptr<DB::IAST>*> >::value) && (is_constructible<std::__1::shared_ptr<DB::IAST>, std::__1::iterator_traits<std::__1::__wrap_iter<std::__1::shared_ptr<DB::IAST>*> >::reference>::value), std::__1::__wrap_iter<std::__1::shared_ptr<DB::IAST>*> >::type std::__1::vector<std::__1::shared_ptr<DB::IAST>, std::__1::allocator<std::__1::shared_ptr<DB::IAST> > >::insert<std::__1::__wrap_iter<std::__1::shared_ptr<DB::IAST>*> >(std::__1::__wrap_iter<std::__1::shared_ptr<DB::IAST> const*>, std::__1::__wrap_iter<std::__1::shared_ptr<DB::IAST>*>, std::__1::__wrap_iter<std::__1::shared_ptr<DB::IAST>*>) @ 0xdef5e7e in /usr/bin/clickhouse
2020.10.26 10:56:31.340957 [ 18476 ] {} <Fatal> BaseDaemon: 3. DB::MySQLInterpreter::InterpreterCreateImpl::getRewrittenQueries(DB::MySQLParser::ASTCreateQuery const&, DB::Context const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0xdeeaeec in /usr/bin/clickhouse
2020.10.26 10:56:31.340979 [ 18476 ] {} <Fatal> BaseDaemon: 4. DB::MySQLInterpreter::InterpreterMySQLDDLQuery<DB::MySQLInterpreter::InterpreterCreateImpl>::execute() @ 0xdb5214c in /usr/bin/clickhouse
2020.10.26 10:56:31.340993 [ 18476 ] {} <Fatal> BaseDaemon: 5. DB::InterpreterExternalDDLQuery::execute() @ 0xdb511d7 in /usr/bin/clickhouse
2020.10.26 10:56:31.341006 [ 18476 ] {} <Fatal> BaseDaemon: 6. ? @ 0xdecaff8 in /usr/bin/clickhouse
2020.10.26 10:56:31.341022 [ 18476 ] {} <Fatal> BaseDaemon: 7. DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool) @ 0xdec9e9d in /usr/bin/clickhouse
2020.10.26 10:56:31.341036 [ 18476 ] {} <Fatal> BaseDaemon: 8. ? @ 0xdb00ba4 in /usr/bin/clickhouse
2020.10.26 10:56:31.341056 [ 18476 ] {} <Fatal> BaseDaemon: 9. ? @ 0xdb16b98 in /usr/bin/clickhouse
2020.10.26 10:56:31.341094 [ 18476 ] {} <Fatal> BaseDaemon: 10. DB::commitMetadata(std::__1::function<void ()> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0xdb1c79e in /usr/bin/clickhouse
2020.10.26 10:56:31.341111 [ 18476 ] {} <Fatal> BaseDaemon: 11. DB::MaterializeMetadata::transaction(DB::MySQLReplication::Position const&, std::__1::function<void ()> const&) @ 0xdb1cc91 in /usr/bin/clickhouse
2020.10.26 10:56:31.341126 [ 18476 ] {} <Fatal> BaseDaemon: 12. DB::MaterializeMySQLSyncThread::prepareSynchronized(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0xdafa7a9 in /usr/bin/clickhouse
2020.10.26 10:56:31.341146 [ 18476 ] {} <Fatal> BaseDaemon: 13. DB::MaterializeMySQLSyncThread::synchronization(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0xdaf9e2a in /usr/bin/clickhouse
2020.10.26 10:56:31.341174 [ 18476 ] {} <Fatal> BaseDaemon: 14. ? @ 0xdb162cd in /usr/bin/clickhouse
2020.10.26 10:56:31.341189 [ 18476 ] {} <Fatal> BaseDaemon: 15. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x7b8b75d in /usr/bin/clickhouse
2020.10.26 10:56:31.341203 [ 18476 ] {} <Fatal> BaseDaemon: 16. ? @ 0x7b8f273 in /usr/bin/clickhouse
2020.10.26 10:56:31.341232 [ 18476 ] {} <Fatal> BaseDaemon: 17. start_thread @ 0x82de in /usr/lib64/libpthread-2.28.so
2020.10.26 10:56:31.341254 [ 18476 ] {} <Fatal> BaseDaemon: 18. clone @ 0xfc133 in /usr/lib64/libc-2.28.so
2020.10.26 10:57:13.074460 [ 18605 ] {} <Fatal> BaseDaemon: ########################################
@lostsnow lostsnow added the bug Confirmed user-visible misbehaviour in official release label Oct 26, 2020
@TCeason
Copy link
Contributor

TCeason commented Oct 29, 2020

Try to build the newest version?

@lostsnow
Copy link
Author

Try to build the newest version?

Upgrade to version 20.11.2.1 (official build) still has this error.

@TCeason
Copy link
Contributor

TCeason commented Nov 12, 2020

Could you provide you table structure under the mysql database?

@lostsnow
Copy link
Author

Could you provide you table structure under the mysql database?

Over 70 tables, and I don't know which one's causing the problems.

@TCeason
Copy link
Contributor

TCeason commented Nov 12, 2020

Could you provide you table structure under the mysql database?

Over 70 tables, and I don't know which one's causing the problems.

I think you can use information_schema to verify which type of cols under the table.

e.g.

root@mysqldb 17:27:36 [information_schema]> select COLUMN_TYPE, COLUMN_KEY from COLUMNS where TABLE_SCHEMA='test_database';
+-------------+------------+
| COLUMN_TYPE | COLUMN_KEY |
+-------------+------------+
| int(11)     | PRI        |
| int(11)     | PRI        |
| varchar(20) |            |
+-------------+------------+
3 rows in set (0.00 sec)

@lostsnow
Copy link
Author

+------------------------+------------+
| COLUMN_TYPE            | COLUMN_KEY |
+------------------------+------------+
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| tinyint(4)             |            |
| decimal(10,2) unsigned |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| tinyint(4) unsigned    |            |
| tinyint(4) unsigned    |            |
| varchar(128)           | UNI        |
| tinyint(4)             |            |
| datetime               | MUL        |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| smallint(6)            |            |
| varchar(255)           |            |
| text                   |            |
| int(10) unsigned       |            |
| int(10) unsigned       |            |
| int(10) unsigned       |            |
| text                   |            |
| text                   |            |
| varchar(255)           |            |
| varchar(255)           |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | UNI        |
| varchar(255)           |            |
| text                   |            |
| text                   |            |
| text                   |            |
| text                   |            |
| text                   |            |
| varchar(255)           |            |
| text                   |            |
| text                   |            |
| text                   |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| varchar(255)           |            |
| text                   |            |
| smallint(6)            |            |
| bigint(20) unsigned    |            |
| int(10) unsigned       |            |
| int(10) unsigned       |            |
| tinyint(4)             |            |
| tinyint(4)             |            |
| tinyint(4)             |            |
| text                   |            |
| datetime               |            |
| datetime               |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             |            |
| bigint(20)             |            |
| bigint(20)             | MUL        |
| int(10)                |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             |            |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| int(10)                |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             |            |
| varchar(255)           |            |
| decimal(10,2)          |            |
| decimal(10,2)          |            |
| bigint(20)             | MUL        |
| varchar(32)            |            |
| bigint(20)             |            |
| int(4)                 |            |
| varchar(128)           | UNI        |
| int(4)                 |            |
| int(10)                |            |
| int(10)                |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| int(10)                |            |
| int(10)                |            |
| datetime               | MUL        |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| varchar(64)            |            |
| int(10)                |            |
| decimal(10,2)          |            |
| decimal(10,2)          |            |
| decimal(10,2)          |            |
| tinyint(4)             |            |
| int(11)                |            |
| int(4)                 |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| decimal(10,2)          |            |
| decimal(10,2)          |            |
| decimal(10,2)          |            |
| decimal(10,2)          |            |
| decimal(10,2)          |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             |            |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| decimal(10,2)          |            |
| int(10)                |            |
| int(10)                |            |
| int(10)                |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| datetime               |            |
| int(4)                 |            |
| varchar(128)           |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             |            |
| bigint(20)             |            |
| bigint(20)             | MUL        |
| int(4)                 |            |
| decimal(10,4)          |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| smallint(5)            |            |
| varchar(255)           |            |
| varchar(255)           |            |
| text                   |            |
| varchar(255)           |            |
| smallint(6)            |            |
| varchar(255)           |            |
| tinyint(4)             |            |
| bigint(20)             |            |
| int(11)                |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| varchar(255)           |            |
| smallint(6)            |            |
| varchar(255)           |            |
| smallint(6)            |            |
| smallint(6)            |            |
| varchar(255)           |            |
| tinyint(4)             |            |
| int(11)                |            |
| tinyint(4) unsigned    |            |
| text                   |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| tinyint(4)             |            |
| bigint(20) unsigned    | MUL        |
| bigint(20) unsigned    | MUL        |
| bigint(20) unsigned    |            |
| text                   |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| int(11)                | MUL        |
| smallint(6)            |            |
| decimal(24,6)          |            |
| decimal(24,6)          |            |
| decimal(24,6)          |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| varchar(255)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| smallint(6)            |            |
| smallint(6)            |            |
| smallint(6)            |            |
| bigint(20)             |            |
| int(11)                |            |
| text                   |            |
| text                   |            |
| text                   |            |
| text                   |            |
| smallint(6)            |            |
| varchar(255)           |            |
| smallint(6)            |            |
| int(11)                |            |
| int(11)                |            |
| int(11)                |            |
| int(11)                |            |
| int(11)                |            |
| decimal(5,1)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| int(11)                |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| varchar(128)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             |            |
| varchar(128)           |            |
| bigint(20)             | MUL        |
| bigint(20)             |            |
| varchar(255)           |            |
| varchar(128)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| text                   |            |
| datetime               |            |
| datetime               |            |
| bigint(20)             | PRI        |
| bigint(20)             | MUL        |
| smallint(6)            |            |
| varchar(255)           |            |
| smallint(6)            |            |
| text                   |            |
| int(11)                |            |
| int(11) unsigned       |            |
| datetime               |            |
| datetime               |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20)             | PRI        |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| varchar(100)           |            |
| int(11) unsigned       |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20)             | PRI        |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| bigint(20)             |            |
| bigint(20)             |            |
| datetime               |            |
| bigint(20)             | PRI        |
| bigint(20)             | MUL        |
| varchar(255)           |            |
| text                   |            |
| varchar(255)           |            |
| smallint(6)            |            |
| smallint(6)            |            |
| smallint(6)            |            |
| text                   |            |
| text                   |            |
| int(11)                |            |
| int(11)                |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| int(11)                |            |
| int(11)                |            |
| smallint(6)            | MUL        |
| datetime               |            |
| datetime               |            |
| bigint(20)             | PRI        |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| varchar(128)           | UNI        |
| text                   |            |
| tinyint(4)             |            |
| text                   |            |
| datetime               | MUL        |
| smallint(6)            |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| tinyint(3) unsigned    |            |
| varchar(64)            |            |
| tinyint(3) unsigned    |            |
| int(10) unsigned       |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             |            |
| bigint(20)             | MUL        |
| bigint(20)             | UNI        |
| varchar(128)           |            |
| bigint(20)             |            |
| varchar(255)           |            |
| varchar(128)           |            |
| text                   |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| int(10) unsigned       |            |
| int(10) unsigned       |            |
| varchar(30)            |            |
| tinyint(3) unsigned    |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| varchar(128)           | MUL        |
| varchar(128)           | UNI        |
| bigint(20) unsigned    | MUL        |
| bigint(20) unsigned    | MUL        |
| varchar(50)            |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| smallint(6)            |            |
| smallint(6)            |            |
| smallint(6)            |            |
| smallint(6)            |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| decimal(20,4)          |            |
| tinyint(3) unsigned    |            |
| tinyint(3) unsigned    |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| smallint(6)            |            |
| varchar(1024)          |            |
| tinyint(4)             |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| varchar(128)           | MUL        |
| bigint(19) unsigned    | PRI        |
| varchar(50)            |            |
| text                   |            |
| varchar(255)           |            |
| tinyint(4)             | MUL        |
| tinyint(4)             |            |
| tinyint(4)             |            |
| text                   |            |
| text                   |            |
| text                   |            |
| tinyint(4)             | MUL        |
| tinyint(4)             |            |
| tinyint(4)             |            |
| varchar(255)           |            |
| smallint(5) unsigned   |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| varchar(32)            | UNI        |
| varchar(32)            |            |
| int(4)                 |            |
| varchar(32)            |            |
| varchar(32)            |            |
| varchar(32)            |            |
| varchar(32)            |            |
| varchar(32)            |            |
| varchar(32)            |            |
| bigint(20)             |            |
| varchar(32)            |            |
| varchar(32)            |            |
| int(4)                 |            |
| int(10)                |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| decimal(10,4)          |            |
| int(4)                 |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| varchar(64)            | UNI        |
| decimal(10,4)          |            |
| int(4)                 |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| bigint(20)             |            |
| bigint(20)             | MUL        |
| varchar(64)            | MUL        |
| bigint(20)             |            |
| int(4)                 |            |
| int(10)                |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| varchar(64)            |            |
| varchar(64)            |            |
| int(4)                 |            |
| int(4)                 |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| int(10)                |            |
| decimal(10,4)          |            |
| varchar(128)           |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| int(4)                 |            |
| decimal(10,4)          |            |
| decimal(10,4)          |            |
| int(10)                |            |
| decimal(10,4)          |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| int(4)                 |            |
| decimal(10,4)          |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| bigint(20) unsigned    | UNI        |
| bigint(20) unsigned    |            |
| varchar(50)            | MUL        |
| tinyint(3) unsigned    |            |
| text                   |            |
| int(10) unsigned       |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| varchar(255)           |            |
| smallint(6)            |            |
| varchar(255)           |            |
| varchar(255)           |            |
| text                   |            |
| datetime               |            |
| varchar(255)           |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| varchar(64)            | MUL        |
| varchar(128)           | UNI        |
| int(10)                |            |
| varchar(128)           |            |
| varchar(256)           |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| int(4)                 |            |
| varchar(128)           |            |
| varchar(128)           |            |
| int(10) unsigned       |            |
| decimal(20,2)          |            |
| int(4)                 |            |
| int(4)                 |            |
| varchar(255)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| bigint(20)             |            |
| datetime               |            |
| datetime               |            |
| tinyint(4)             |            |
| int(10) unsigned       |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| varchar(20)            | MUL        |
| tinyint(4)             |            |
| varchar(255)           |            |
| tinyint(1)             |            |
| varchar(255)           |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| varchar(50)            |            |
| varchar(50)            | MUL        |
| tinyint(3) unsigned    |            |
| smallint(5) unsigned   |            |
| tinyint(3) unsigned    |            |
| tinyint(3) unsigned    |            |
| datetime               |            |
| text                   |            |
| varchar(100)           | UNI        |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| smallint(6)            |            |
| tinyint(4)             |            |
| smallint(6)            |            |
| bigint(20)             |            |
| decimal(24,6)          |            |
| decimal(24,6)          |            |
| varchar(128)           | UNI        |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | UNI        |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| varchar(1024)          |            |
| bigint(20)             |            |
| datetime               |            |
| datetime               |            |
| tinyint(1) unsigned    |            |
| datetime               |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| smallint(6)            |            |
| varchar(255)           |            |
| varchar(255)           |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| bigint(20) unsigned    | MUL        |
| int(10) unsigned       |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| int(10)                |            |
| bigint(20)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| varchar(128)           |            |
| varchar(128)           |            |
| varchar(128)           |            |
| varchar(128)           |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | UNI        |
| int(11) unsigned       |            |
| int(11)                |            |
| int(11) unsigned       |            |
| varchar(200)           |            |
| varchar(2000)          |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    |            |
| smallint(6)            |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| bigint(20)             | MUL        |
| varchar(100)           | UNI        |
| tinyint(4)             |            |
| tinyint(2)             |            |
| decimal(20,4)          |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| bigint(20) unsigned    |            |
| varchar(64)            | UNI        |
| varchar(500)           |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| bigint(20) unsigned    | MUL        |
| bigint(20) unsigned    | MUL        |
| tinyint(4)             | MUL        |
| decimal(20,4)          |            |
| tinyint(4) unsigned    |            |
| datetime               |            |
| datetime               |            |
| bigint(19) unsigned    | PRI        |
| bigint(19) unsigned    | MUL        |
| bigint(19) unsigned    | MUL        |
| tinyint(4)             |            |
| bigint(20)             |            |
| tinyint(4)             | MUL        |
| tinyint(4)             | MUL        |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| int(4)                 |            |
| varchar(128)           | UNI        |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| varchar(128)           | MUL        |
| int(4)                 |            |
| int(4)                 |            |
| varchar(128)           |            |
| varchar(128)           |            |
| varchar(1024)          |            |
| varchar(255)           |            |
| varchar(32)            |            |
| varchar(255)           |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | UNI        |
| varchar(64)            | UNI        |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | UNI        |
| varchar(100)           |            |
| varchar(128)           | UNI        |
| date                   |            |
| varchar(50)            |            |
| tinyint(4)             |            |
| varchar(255)           |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| tinyint(3) unsigned    |            |
| tinyint(3) unsigned    |            |
| int(10) unsigned       |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | UNI        |
| varchar(64)            |            |
| varchar(64)            |            |
| varchar(128)           |            |
| varchar(255)           |            |
| varchar(128)           |            |
| varchar(128)           |            |
| varchar(128)           |            |
| varchar(128)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| tinyint(4)             |            |
| tinyint(4)             |            |
| tinyint(4)             |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| decimal(20,4)          |            |
| varchar(64)            | UNI        |
| bigint(20)             |            |
| tinyint(4)             |            |
| tinyint(4)             |            |
| varchar(512)           |            |
| varchar(255)           |            |
| datetime               |            |
| int(4)                 |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| varchar(32)            |            |
| varchar(32)            |            |
| varchar(32)            |            |
| int(11)                |            |
| varchar(20)            | MUL        |
| varchar(30)            |            |
| varchar(32)            |            |
| tinyint(1) unsigned    |            |
| bigint(20) unsigned    | MUL        |
| bigint(20) unsigned    | MUL        |
| varchar(64)            | UNI        |
| int(11) unsigned       |            |
| int(11) unsigned       |            |
| varchar(64)            |            |
| varchar(64)            | MUL        |
| varchar(64)            | UNI        |
| varchar(255)           |            |
| varchar(255)           |            |
| tinyint(1) unsigned    |            |
| tinyint(1) unsigned    |            |
| datetime               |            |
| datetime               |            |
| tinyint(1) unsigned    |            |
| datetime               |            |
| varchar(2000)          |            |
| int(4)                 |            |
| varchar(128)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| varchar(255)           |            |
| bigint(20) unsigned    | PRI        |
| int(4)                 |            |
| int(4)                 |            |
| varchar(64)            |            |
| varchar(64)            | UNI        |
| varchar(32)            |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               | MUL        |
| bigint(20)             | MUL        |
| varchar(255)           |            |
| varchar(64)            |            |
| datetime               |            |
| datetime               |            |
| bigint(20) unsigned    | PRI        |
| bigint(20)             | MUL        |
| smallint(6)            |            |
| decimal(24,6)          |            |
| tinyint(4)             |            |
| datetime               |            |
| datetime               |            |
+------------------------+------------+
772 rows in set (0.67 sec)

@lostsnow
Copy link
Author

DISTINCT records

mysql> select DISTINCT COLUMN_TYPE, COLUMN_KEY from COLUMNS where TABLE_SCHEMA='xxx';
+------------------------+------------+
| COLUMN_TYPE            | COLUMN_KEY |
+------------------------+------------+
| bigint(20) unsigned    | PRI        |
| bigint(20) unsigned    | MUL        |
| tinyint(4)             |            |
| decimal(10,2) unsigned |            |
| datetime               |            |
| tinyint(4) unsigned    |            |
| varchar(128)           | UNI        |
| datetime               | MUL        |
| smallint(6)            |            |
| varchar(255)           |            |
| text                   |            |
| int(10) unsigned       |            |
| bigint(20) unsigned    | UNI        |
| bigint(20) unsigned    |            |
| bigint(20)             |            |
| bigint(20)             | MUL        |
| int(10)                |            |
| decimal(10,4)          |            |
| decimal(10,2)          |            |
| varchar(32)            |            |
| int(4)                 |            |
| varchar(64)            |            |
| int(11)                |            |
| varchar(128)           |            |
| smallint(5)            |            |
| int(11)                | MUL        |
| decimal(24,6)          |            |
| decimal(5,1)           |            |
| bigint(20)             | PRI        |
| int(11) unsigned       |            |
| varchar(100)           |            |
| smallint(6)            | MUL        |
| tinyint(3) unsigned    |            |
| bigint(20)             | UNI        |
| varchar(30)            |            |
| varchar(128)           | MUL        |
| varchar(50)            |            |
| decimal(20,4)          |            |
| varchar(1024)          |            |
| bigint(19) unsigned    | PRI        |
| tinyint(4)             | MUL        |
| smallint(5) unsigned   |            |
| varchar(32)            | UNI        |
| varchar(64)            | UNI        |
| varchar(64)            | MUL        |
| varchar(50)            | MUL        |
| varchar(256)           |            |
| decimal(20,2)          |            |
| varchar(20)            | MUL        |
| tinyint(1)             |            |
| varchar(100)           | UNI        |
| tinyint(1) unsigned    |            |
| varchar(200)           |            |
| varchar(2000)          |            |
| tinyint(2)             |            |
| varchar(500)           |            |
| bigint(19) unsigned    | MUL        |
| date                   |            |
| varchar(512)           |            |
+------------------------+------------+
59 rows in set (0.20 sec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed user-visible misbehaviour in official release comp-mysql crash Crash / segfault / abort
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants