(occurred when comma is the last character in the result string.
!ENTRY org.jkiss.dbeaver.model 2 0 2024-11-22 16:22:33.474
!MESSAGE Can't read column 'TABLES_ARR' value
!SUBENTRY 1 org.jkiss.dbeaver.model 2 0 2024-11-22 16:22:33.474
!MESSAGE begin 1, end 0, length 1
!STACK 0
java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1
at java.base/java.lang.String.checkBoundsBeginEnd(Unknown Source)
at java.base/java.lang.String.substring(Unknown Source)
at org.jkiss.dbeaver.model.impl.jdbc.data.JDBCCollection.makeCollectionFromString(JDBCCollection.java:480)
at org.jkiss.dbeaver.model.impl.jdbc.data.handlers.JDBCArrayValueHandler.getValueFromObject(JDBCArrayValueHandler.java:79)
at org.jkiss.dbeaver.model.impl.jdbc.data.handlers.JDBCComplexValueHandler.fetchColumnValue(JDBCComplexValueHandler.java:50)
at org.jkiss.dbeaver.model.impl.jdbc.data.handlers.JDBCArrayValueHandler.fetchColumnValue(JDBCArrayValueHandler.java:60)
at org.jkiss.dbeaver.model.impl.jdbc.data.handlers.JDBCAbstractValueHandler.fetchValueObject(JDBCAbstractValueHandler.java:49)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetDataReceiver.fetchRow(ResultSetDataReceiver.java:126)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.fetchQueryData(SQLQueryJob.java:911)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:682)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$2(SQLQueryJob.java:522)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:192)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:541)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:1007)
at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:4271)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:128)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:192)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:126)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:5166)
at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:119)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
I reproduced it using the 3.16.0 version of the driver. Interestingly enough, it's not reproducible against 3.20.0 because arrays are returned as strings.
Description
SQL
select REGEXP_SUBSTR_ALL('FROM select from AAAA, LATERAL S', 'from\\s+[^\(\\s]+', 1, 1, 'im') TABLES_ARR;
Error
(occurred when comma is the last character in the result string.
same SQL in snowsql
See "Additional context" for other parsing issues.
DBeaver Version
Community Edition 24.2.5.202411171748
Operating System
Windows 11 Enterprise Version 23H2
Database and driver
Database: Snowflake Server 8.44.2 JDBC Driver: 3.16.0 (snowflake-jdbc-3.16.0.jar)
Steps to reproduce
select REGEXP_SUBSTR_ALL('FROM select from AAAA, LATERAL S', 'from\\s+[^\(\\s]+', 1, 1, 'im') TABLES_ARR;
instead of '[| "FROM select", "from AAAA," ]' shown 'java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1'
Additional context
More examples:
Exception when a comma is the last character
Other issues:
TABLES_ARR_AS_JSON - expected resulst