Skip to content

Enums in MySQL engine  #3985

@filimonov

Description

@filimonov

Currently MySQL engine supports writing Enums, but doesn't support reading Enums.

mysql> create table mysql_enum ( `source` enum('IP','URL') NOT NULL ) ;
Query OK, 0 rows affected (0.07 sec)

:) create table mysql_enum_mapping ( source Enum8('IP' = 1, 'URL' = 2) ) Engine = MySQL('127.0.0.1','test','mysql_enum','root','');

:) insert into mysql_enum_mapping values ( cast('IP', 'Enum8(\'IP\' = 1, \'URL\' = 2)') );
Ok.
1 rows in set. Elapsed: 0.009 sec. 

:) SELECT * FROM mysql_enum_mapping;

Error> executeQuery: Code: 50, e.displayText() = DB::Exception: Unsupported type Enum8('IP' = 1, 'URL' = 2), e.what() = DB::Exception (from [::1]:40808) (in query: select * from mysql_enum_mapping), Stack trace:

0. clickhouse-server(StackTrace::StackTrace()+0x16) [0x5e3f7e6]
1. clickhouse-server(DB::ExternalResultDescription::init(DB::Block const&)+0x368) [0x5de41f8]
2. clickhouse-server(DB::MySQLBlockInputStream::MySQLBlockInputStream(mysqlxx::Pool::Entry const&, std::string const&, DB::Block const&, unsigned long)+0x139) [0x5672439]
3. clickhouse-server(DB::StorageMySQL::read(std::vector<std::string, std::allocator<std::string> > const&, DB::SelectQueryInfo const&, DB::Context const&, DB::QueryProcessingStage::Enum, unsigned long, unsigned int)+0x22a) [0x4fa302a]
4. clickhouse-server(DB::InterpreterSelectQuery::executeFetchColumns(DB::QueryProcessingStage::Enum, DB::InterpreterSelectQuery::Pipeline&, std::shared_ptr<DB::PrewhereInfo> const&, std::vector<std::string, std::allocator<std::string> > const&)+0x14de) [0x4dce87e]
5. clickhouse-server(DB::InterpreterSelectQuery::executeImpl(DB::InterpreterSelectQuery::Pipeline&, std::shared_ptr<DB::IBlockInputStream> const&, bool)+0x3f5) [0x4dd0a15]
6. clickhouse-server(DB::InterpreterSelectQuery::executeWithMultipleStreams()+0x3a) [0x4dd343a]
7. clickhouse-server(DB::InterpreterSelectWithUnionQuery::executeWithMultipleStreams()+0x5c) [0x4ddd6bc]
8. clickhouse-server(DB::InterpreterSelectWithUnionQuery::execute()+0x26) [0x4ddd956]
9. clickhouse-server() [0x4eadddc]
10. clickhouse-server(DB::executeQuery(std::string const&, DB::Context&, bool, DB::QueryProcessingStage::Enum)+0x70) [0x4eafec0]
11. clickhouse-server(DB::TCPHandler::runImpl()+0x547) [0x2bdc277]
12. clickhouse-server(DB::TCPHandler::run()+0x1c) [0x2bdd4dc]
13. clickhouse-server(Poco::Net::TCPServerConnection::start()+0xf) [0x5fc3cef]
14. clickhouse-server(Poco::Net::TCPServerDispatcher::run()+0x166) [0x5fc40b6]
15. clickhouse-server(Poco::PooledThread::run()+0x77) [0x62755a7]
16. clickhouse-server(Poco::ThreadImpl::runnableEntry(void*)+0x38) [0x6271768]
17. clickhouse-server() [0x6a7fa8f]
18. /lib64/libpthread.so.0(+0x7e25) [0x7fa97c380e25]
19. /lib64/libc.so.6(clone+0x6d) [0x7fa97bba434d]

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp-foreign-dbConnectivity to external databases (ODBC/JDBC, MySQL, PostgreSQL, etc.).comp-mysqlMySQL-specific integration (table engine/function/protocol mapping).easy taskGood for first contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions