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

Error when executing SHOW CREATE TABLE in CloudBeaver - “Can’t detect row identifier” #3062

Open
matthieukhl opened this issue Nov 8, 2024 · 1 comment

Comments

@matthieukhl
Copy link
Contributor

Describe the bug
I am experiencing an issue when trying to execute a SHOW CREATE TABLE statement on a table with a great amount of rows. This error appears specifically when the SHOW CREATE TABLE statement returns a lengthy output, describing complex or large tables. It seems that CloudBeaver is unable to process the result correctly, as it lacks a unique row identifier for this type of non-tabular data. CloudBeaver returns the following error message:

Error reading value: Can't detect row identifier for data container 'show create table <table_name>'. It must have at least one unique key.

Additional Context

  • I have adjusted the sqlTextPreviewLength parameter to 65536 bytes, but it did not resolve the issue.
  • This behavior seems to be more prevalent for SHOW commands with lengthy output that do not return data in a typical tabular format, making it difficult for CloudBeaver to identify rows uniquely.
  • Regular SELECT queries with unique identifiers function as expected without errors.

To Reproduce
Steps to reproduce the behavior:

  1. Create a lengthy table:
CREATE TABLE `sample_table` (
  `record_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `transaction_id` bigint(21) unsigned NOT NULL,
  `session_id` bigint(21) unsigned NOT NULL,
  `user_ref` bigint(20) DEFAULT NULL,
  `group_ref` int(11) DEFAULT NULL,
  `entity_ref` bigint(20) DEFAULT NULL,
  `meeting_ref` bigint(20) DEFAULT NULL,
  `start_time` timestamp(6) DEFAULT CURRENT_TIMESTAMP(6),
  `response_time` timestamp NULL DEFAULT NULL,
  `end_time` timestamp NULL DEFAULT NULL,
  `code_value` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `status_flag` int(11) NOT NULL DEFAULT '0',
  `identifier` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `reference_code` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `history_data` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `routing_value` int(11) DEFAULT NULL,
  `rate_value` int(11) DEFAULT '0',
  `duration_start` int(11) DEFAULT '0',
  `duration_end` int(11) DEFAULT '0',
  `cost_initial` int(11) NOT NULL DEFAULT '0',
  `cost_final` int(11) DEFAULT '0',
  `total_value` int(11) NOT NULL DEFAULT '0',
  `income_amount` int(11) NOT NULL DEFAULT '0',
  `profit_margin` int(11) NOT NULL DEFAULT '0',
  `remarks` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT 'General',
  `rate_base` int(11) NOT NULL DEFAULT '0',
  `rate_increment` int(11) NOT NULL DEFAULT '0',
  `context_value` char(3) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'def',
  `event_cause` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT 'Sample Comment Field',
  `final_state` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `description_field` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `trigger_source` enum('SOURCE1','SOURCE2') CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'SOURCE1',
  `device_type` enum('TYPE_A','TYPE_B','TYPE_C') CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT 'Sample Device Comment',
  `transfer_mode` enum('MODE1','MODE2','MODE3') CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'MODE1',
  `transfer_target` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `log_id` int(11) DEFAULT NULL,
  `record_number` int(11) DEFAULT NULL,
  `fax_number` int(11) DEFAULT NULL,
  `hardware_type` varchar(16) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `user_agent` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `url_reference` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `performance_score` decimal(10,2) NOT NULL DEFAULT '100.00',
  `archive_flag` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Archival states',
  `label` enum('LABEL_A','LABEL_B','LABEL_C','LABEL_D') CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `server_identifier` int(10) unsigned DEFAULT NULL,
  `country_code_from` char(2) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `country_code_to` char(2) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `last_updated` timestamp(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
  PRIMARY KEY (`record_id`),
  KEY `idx_end_time` (`end_time`),
  KEY `idx_transaction_id` (`transaction_id`),
  KEY `idx_group_start_time` (`group_ref`,`start_time`),
  KEY `idx_user_start_time` (`user_ref`,`start_time`),
  KEY `idx_entity_start_time` (`entity_ref`,`start_time`),
  KEY `idx_reference_start_time` (`reference_code`,`start_time`),
  KEY `idx_identifier_start_time` (`identifier`,`start_time`),
  KEY `idx_code_start_time` (`code_value`,`start_time`),
  UNIQUE KEY `session_unique` (`session_id`),
  KEY `idx_last_updated` (`last_updated`),
  KEY `idx_group_transaction` (`group_ref`,`transaction_id`),
  KEY `idx_combined_code_start_time` (`group_ref`,`code_value`,`start_time`),
  KEY `idx_time_only` (`start_time`),
  KEY `idx_combined_identifier_start_time` (`group_ref`,`identifier`,`start_time`),
  KEY `idx_combined_reference_start_time` (`group_ref`,`reference_code`,`start_time`),
  KEY `idx_combined_session` (`group_ref`,`session_id`),
  KEY `idx_group_user_start_time` (`group_ref`,`user_ref`,`start_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci AUTO_INCREMENT=1;
  1. Run the SHOW CREATE TABLE sample_data statement.
  2. Select the column output in the UI, then click the "Value" button on the right-hand side of the screen.
  3. Click on "Show More" at the bottom right-hand side of the screen. The error should appear in the bottom-left corner of your screen.

Screenshots
Capture d’écran 2024-11-08 à 09 42 20

Desktop (please complete the following information):

  • OS: macOS Sequoia 15.0
  • Browser Google Chrome 130.0.6723.93 (arm64)
  • Version 24.2

Logs

io.cloudbeaver.DBWebException: Error reading value :
Can't detect row identifier for data container 'show create table <table_name>;'. It must have at least one unique key.
	at io.cloudbeaver.service.sql.impl.WebServiceSQL.readValue(WebServiceSQL.java:380)
	at io.cloudbeaver.service.sql.impl.WebServiceSQL.getCellValue(WebServiceSQL.java:356)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.cloudbeaver.service.WebServiceBindingBase$ServiceInvocationHandler.invoke(WebServiceBindingBase.java:169)
	at jdk.proxy6/jdk.proxy6.$Proxy17.getCellValue(Unknown Source)
	at io.cloudbeaver.service.sql.WebServiceBindingSQL.lambda$16(WebServiceBindingSQL.java:147)
	at graphql.execution.ExecutionStrategy.invokeDataFetcher(ExecutionStrategy.java:327)
	at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:304)
	at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:242)
	at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:213)
	at graphql.execution.AsyncExecutionStrategy.execute(AsyncExecutionStrategy.java:63)
	at graphql.execution.Execution.executeOperation(Execution.java:162)
	at graphql.execution.Execution.execute(Execution.java:105)
	at graphql.GraphQL.execute(GraphQL.java:557)
	at graphql.GraphQL.lambda$parseValidateAndExecute$11(GraphQL.java:476)
	at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1187)
	at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
	at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:471)
	at graphql.GraphQL.executeAsync(GraphQL.java:439)
	at graphql.GraphQL.execute(GraphQL.java:365)
	at io.cloudbeaver.server.graphql.GraphQLEndpoint.executeQuery(GraphQLEndpoint.java:257)
	at io.cloudbeaver.server.graphql.GraphQLEndpoint.executeSingleQuery(GraphQLEndpoint.java:203)
	at io.cloudbeaver.server.graphql.GraphQLEndpoint.doPost(GraphQLEndpoint.java:186)
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:520)
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
	at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:170)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
	at org.eclipse.jetty.server.Server.handle(Server.java:563)
	at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
	at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: io.cloudbeaver.DBWebException: Can't detect row identifier for data container 'show create table <table_name>;'. It must have at least one unique key.
	at io.cloudbeaver.service.sql.WebSQLProcessor.checkRowIdentifier(WebSQLProcessor.java:941)
	at io.cloudbeaver.service.sql.WebSQLProcessor.readStringValue(WebSQLProcessor.java:930)
	at io.cloudbeaver.service.sql.impl.WebServiceSQL.lambda$3(WebServiceSQL.java:354)
	at io.cloudbeaver.service.sql.impl.WebServiceSQL.lambda$4(WebServiceSQL.java:372)
	at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:192)
	at io.cloudbeaver.service.sql.impl.WebServiceSQL.readValue(WebServiceSQL.java:367)
	... 61 common frames omitted
@matthieukhl matthieukhl added bug Something isn't working wait for review labels Nov 8, 2024
@EvgeniaBzzz
Copy link
Contributor

Hi @matthieukhl
Thank you for your report! We’ll investigate and find a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants