-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
A-sql-plpgsqlPL/pgSQL languagePL/pgSQL languageC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the communityT-sql-queriesSQL Queries TeamSQL Queries Teambranch-release-25.4Used to mark GA and release blockers and technical advisories for 25.4Used to mark GA and release blockers and technical advisories for 25.4branch-release-26.1Used to mark GA and release blockers, technical advisories, and bugs for 26.1Used to mark GA and release blockers, technical advisories, and bugs for 26.1target-release-26.2.0v26.1.0-prerelease
Description
Describe the problem
When a procedure contains a commit statement, calling it from JDBC will produce a NoSuchElementException. This is likely due to some wire protocol implementation error. The same error does not appear on vanilla PostgreSQL with the same JDBC driver version
To Reproduce
Run this script from a Java client (e.g. Dbeaver):
create table "t" (
"a" int4,
"b" int4,
"c" int4
);
create procedure "proc_TransactionCommit"()
language plpgsql
as
$$
begin
insert into "t" ("a", "b", "c")
values (
1,
null,
null
);
commit;
end;
$$
call "proc_TransactionCommit" ();The procedure call at the end produces this error in Dbeaver with auto commit active (but it can be used in any other JDBC client application):
org.jkiss.dbeaver.model.sql.DBSQLException: SQL Error: Internal jdbc driver error
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCPreparedStatementImpl.executeStatement(JDBCPreparedStatementImpl.java:208)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:657)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$2(SQLQueryJob.java:550)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:189)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:569)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:1043)
at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:4363)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:128)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:189)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:126)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:5145)
at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:119)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.sql.SQLException: Internal jdbc driver error
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.handleExecuteError(JDBCStatementImpl.java:298)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCPreparedStatementImpl.execute(JDBCPreparedStatementImpl.java:263)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCPreparedStatementImpl.executeStatement(JDBCPreparedStatementImpl.java:205)
... 12 more
Caused by: java.util.NoSuchElementException
at java.base/java.util.ArrayDeque.removeFirst(Unknown Source)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2489)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:371)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:502)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:419)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:194)
at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:180)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCPreparedStatementImpl.execute(JDBCPreparedStatementImpl.java:261)
... 13 more
Expected behavior
The call should work and the row should be inserted.
Environment:
- CockroachDB version: CockroachDB CCL v25.4.1 (x86_64-pc-linux-gnu, built 2025/11/26 12:08:42, go1.23.12 X:nocoverageredesign)
- Client app: JDBC (
org.postgresql:postgresql:42.7.8)
Jira issue: CRDB-57487
Metadata
Metadata
Assignees
Labels
A-sql-plpgsqlPL/pgSQL languagePL/pgSQL languageC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the communityT-sql-queriesSQL Queries TeamSQL Queries Teambranch-release-25.4Used to mark GA and release blockers and technical advisories for 25.4Used to mark GA and release blockers and technical advisories for 25.4branch-release-26.1Used to mark GA and release blockers, technical advisories, and bugs for 26.1Used to mark GA and release blockers, technical advisories, and bugs for 26.1target-release-26.2.0v26.1.0-prerelease
Type
Projects
Status
Done