cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.77k stars 3.76k forks source link

roachtest: unoptimized-query-oracle: missing cast to REGCLASS #122788

Open cockroach-teamcity opened 4 months ago

cockroach-teamcity commented 4 months ago

roachtest.unoptimized-query-oracle/disable-rules=all/rand-tables failed with artifacts on release-23.2 @ d91ca866b265a837f832bc93b59481847d721f18:

(query_comparison_util.go:389).runOneRoundQueryComparison: . 1022 statements run: expected unoptimized and optimized results to be equal
  []string{
-   ``e'\'tab{le2\'',ntehuv``,
+   "105,ntehuv",
  }
sql: SELECT
    (SELECT tab_29.col1_9 AS col_68 FROM defaultdb.public.table1@[0] AS tab_29 ORDER BY col_68 DESC LIMIT 1:::INT8)
        AS col_69,
    'ntehuv':::rand_typ_2 AS col_70
ORDER BY
    col_70 DESC NULLS FIRST, col_69 DESC
LIMIT
    72:::INT8
test artifacts and logs in: /artifacts/unoptimized-query-oracle/disable-rules=all/rand-tables/run_1

Parameters:

See: roachtest README

See: How To Investigate (internal)

See: Grafana

Same failure on other branches

- #122786 roachtest: unoptimized-query-oracle/disable-rules=all/rand-tables failed [C-test-failure O-roachtest O-robot T-sql-queries branch-release-23.1 release-blocker]

/cc @cockroachdb/sql-queries

This test on roachdash | Improve this report!

Jira issue: CRDB-38067

mgartner commented 4 months ago

A reduced reproduction on v23.2.1:

CREATE TABLE t (a REGCLASS);

INSERT INTO t AS tab_1 VALUES ('t'::REGCLASS);

SET testing_optimizer_disable_rule_probability = 1.000000;

SET vectorize = off;

SELECT (SELECT a FROM t);
--   a
-- -----
--   t
-- (1 row)

RESET testing_optimizer_disable_rule_probability;

SELECT (SELECT a FROM t);
--    a
-- -------
--   104
-- (1 row)
mgartner commented 4 months ago

This reproduces on v23.1.13, so removing release-blocker label.

yuzefovich commented 4 months ago

Postgres returns t, so it looks like we're dropping the cast to REGCLASS or handling that cast incorrectly. I'll move it into bugs-to-fix with P-3 label for now (until we seen a couple of more instances of this to bump to P-2).