Describe the problem
The latest version of CockroachDB (fd0934b) causes an Internal Error when executing the following query:
# poc
CREATE TABLE v0 (c1 TIME);
SELECT * FROM v0 WHERE () < '06:57:30';
To Reproduce
Here is the detail steps to reproduce the bug.
- In system Ubuntu 20.04, download the CockroachDB source code from the github source.
- Use the latest version of the CockroachDB code (tested version: fd0934b)
- Directly make install in the root repository folder.
- Run ./cockroach demo, and then paste the PoC query to the cockroach cli environment.
- Observe the
Internal Error.
# poc
CREATE TABLE v0 (c1 TIME);
SELECT * FROM v0 WHERE () < '06:57:30';
Expected behavior
The CockroachDB server should return the following error:
ERROR: unsupported comparison operator: <tuple> < <string>
SQLSTATE: 22023
Additional data / screenshots
Internal Error information:
demo@127.0.0.1:26257/movr> CREATE TABLE v0 (c1 TIME);
CREATE TABLE
Time: 5ms total (execution 5ms / network 0ms)
demo@127.0.0.1:26257/movr> SELECT * FROM v0 WHERE () < '06:57:30';
ERROR: internal error: comparison overload not found (lt, tuple, string)
SQLSTATE: XX000
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/sql/opt/memo/logical_props_builder.go:1676: BuildSharedProps()
github.com/cockroachdb/cockroach/pkg/sql/opt/memo/logical_props_builder.go:1523: buildFiltersItemProps()
github.com/cockroachdb/cockroach/pkg/sql/opt/memo/expr.og.go:9266: PopulateProps()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:12421: ConstructFiltersItem()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:1190: buildWhere()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:1061: buildSelectClause()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:1006: buildSelectStmtWithoutParens()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:975: func1()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/with.go:116: processWiths()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:974: buildSelect()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:305: buildStmt()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:252: buildStmtAtRoot()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:226: Build()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:563: buildExecMemo()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:231: makeOptimizerPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1469: makeExecPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1094: dispatchToExecutionEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:723: execStmtInOpenState()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:127: func1()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:2417: execWithProfiling()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:126: execStmt()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1927: func1()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1932: execCmd()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1852: run()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:830: ServeConn()
github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:728: func1()
runtime/asm_arm64.s:1165: goexit()
HINT: You have encountered an unexpected error.
Please check the public issue tracker to check whether this problem is
already tracked. If you cannot find it there, please report the error
with details by creating a new issue.
If you would rather not post publicly, please contact us directly
using the support form.
# poc
CREATE TABLE v0 (c1 TIME);
SELECT * FROM v0 WHERE () < '06:57:30';
Environment:
- CockroachDB version: v23.1.0-alpha.00000000-103-gfd0934bf92-dirty
- Server OS: Ubuntu 20.04 LTS
- Client app: CockroachDB demo command. (
./cockroach demo)
- Detailed CockroachDB version output:
cockroach version details:
Build Tag: v23.1.0-alpha.00000000-103-gfd0934bf92-dirty
Build Time: 2022/11/08 16:36:59
Distribution: CCL
Platform: linux arm64 (aarch64-linux-gnu)
Go Version: go1.19
C Compiler: gcc 9.4.0
Build Commit ID: fd0934bf92815b4ef3a98f093d89e41180ff13d5
Build Type: development
Additional context
The problem is reproducible on all versions from v22.2.* and v22.1.*. But it CANNOT trace back to version v21.2.* and the versions before (the history versions are behaving correctly). Seems the problem is introduced in a commit in version v21.1.
Jira issue: CRDB-21307
Describe the problem
The latest version of CockroachDB (fd0934b) causes an
Internal Errorwhen executing the following query:To Reproduce
Here is the detail steps to reproduce the bug.
Internal Error.Expected behavior
The
CockroachDBserver should return the following error:Additional data / screenshots
Internal Errorinformation:Environment:
./cockroach demo)Additional context
The problem is reproducible on all versions from
v22.2.*andv22.1.*. But it CANNOT trace back to versionv21.2.*and the versions before (the history versions are behaving correctly). Seems the problem is introduced in a commit in versionv21.1.Jira issue: CRDB-21307