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
30.11k stars 3.81k forks source link

sql/tests: TestRandomSyntaxSQLSmith failed [comparison overload not found (eq, refcursor, refcursor)] #112363

Closed cockroach-teamcity closed 1 year ago

cockroach-teamcity commented 1 year ago

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on release-23.2 @ abd56c6d6e9dbf131fc1fa0d3f8d1fbcfb7e4901:

Random syntax error:

    rsg_test.go:895: Crash detected: server panic: pq: internal error: comparison overload not found (eq, refcursor, refcursor)

Query:

        SELECT
            t🙄ab320.tableoid AS col633,
            "tAb318".col😣1_4 AS col634,
            "tAb318".col1_9 AS col635,
            NULL AS "😸co l*636",
            tab317._float8 AS "col�😻637"
        FROM
            defaultdb.public.seed@seed__int8__float8__date_idx AS tab317,
            defaultdb.public."ta ble1"@[0] AS "tAb318",
            defaultdb.public."t'a%pble2"@[0] AS "|tab😷319"
            JOIN defaultdb.public."tab\\x70le4"@"tab\\x70le4_col4_0_co̅l4_3_col4_2_col4%p_1_idx" AS t🙄ab320 ON
                    ("|tab😷319".col2_1) = (t🙄ab320.tableoid) AND ("|tab😷319".tableoid) = (t🙄ab320.tableoid)
        LIMIT
            16:::INT8;

Schema:

    rsg_test.go:704: To reproduce, use schema:
    rsg_test.go:706: SET sql_safe_updates = false;;
    rsg_test.go:706: SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;;
    rsg_test.go:706: SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;;
    rsg_test.go:706: CREATE TABLE "ta ble1" (col1_0 OID NULL, col1_1 TSQUERY NULL, col1_2 TIME NULL, "co\\u62A8l1_3" TIMETZ NOT NULL, col😣1_4 TIMETZ, col1_5 TSVECTOR NOT NULL, "col'1_6" TSQUERY NULL, col1_7 STRING NULL AS (lower(CAST("col'1_6" AS STRING))) VIRTUAL, col1_8 STRING NULL AS (lower(CAST(col1_1 AS STRING))) STORED, col1_9 STRING NULL AS (lower(CAST(col1_1 AS STRING))) VIRTUAL, "col1 _�10" STRING NOT NULL AS (lower(CAST(col1_5 AS STRING))) STORED, col1_11 STRING NULL AS (lower(CAST(col1_0 AS STRING))) VIRTUAL, FAMILY ("col'1_6", col😣1_4, col1_1), FAMILY (col1_5, "col1 _�10"), FAMILY (col1_0, col1_2), FAMILY ("co\\u62A8l1_3", col1_8));
    rsg_test.go:706: CREATE TABLE "t'a%pble2" (col2_0 REFCURSOR NOT NULL, col2_1 OID NOT NULL, PRIMARY KEY (col2_1 DESC), UNIQUE (col2_1 DESC, col2_0 ASC), INDEX (col2_0 DESC, col2_1), INDEX (col2_0 ASC) PARTITION BY LIST (col2_0) (PARTITION "😿t'a%pble2_par%qt0" VALUES IN ((e'\'':::REFCURSOR,), (e'g\x1c9lw,LVp':::REFCURSOR,), (e'^c \fh':::REFCURSOR,), (e'\x18':::REFCURSOR,), (e'me\x1d.':::REFCURSOR,), (e'\x16es0':::REFCURSOR,)), PARTITION "t'a%pble2_part1" VALUES IN (('O3':::REFCURSOR,), (e'C\t\x18':::REFCURSOR,), (e'\x19\x1esc\n\x1c':::REFCURSOR,), ('g':::REFCURSOR,), (e'#\x1f\x12i\r4':::REFCURSOR,), (e'j\x18\b\x11eSC]s':::REFCURSOR,)), PARTITION "t'a%pble2_part2" VALUES IN ((e'd\x1c\x0e\x19\x16u':::REFCURSOR,), (e'\n/^jw':::REFCURSOR,), (e'!h3\x13%':::REFCURSOR,), ('N':::REFCURSOR,), ('d':::REFCURSOR,), ('!':::REFCURSOR,))), INDEX (col2_0, col2_1 DESC) PARTITION BY LIST (col2_0) (PARTITION "t'a%pble2_part0" VALUES IN ((e'\x7fq\x1b\x1b9\x18w':::REFCURSOR,), ('':::REFCURSOR,), (e'\x00':::REFCURSOR,), ('O4':::REFCURSOR,), ('4':::REFCURSOR,)), PARTITION "t\\U000FCCC8'a%pble2_ part1" VALUES IN ((e':"\x1d\x15$':::REFCURSOR,), ('N3q':::REFCURSOR,), (e's\x1ccKZ':::REFCURSOR,), ('!(':::REFCURSOR,), (e'6\x13\x025L>4\x1b':::REFCURSOR,)), PARTITION "t'a%pble2_part2" VALUES IN ((e'\x1f':::REFCURSOR,), ('5<':::REFCURSOR,), ('|p':::REFCURSOR,), (e';\x17\x04':::REFCURSOR,)), PARTITION "t'a%pble
2_part3" VALUES IN (('e|':::REFCURSOR,), ('-g':::REFCURSOR,), ('q':::REFCURSOR,), (e'P&Aq\x7f\x0e':::REFCURSOR,), (e'\x05s_\x18\x17@':::REFCURSOR,)), PARTITION "DEFAULT" VALUES IN ((DEFAULT,))), UNIQUE (col2_0 ASC, col2_1 DESC), UNIQUE (lower(CAST(col2_1 AS STRING))), INDEX (col2_0 ASC));
    rsg_test.go:706: CREATE TABLE table3 ("c�ol3_0" INET[] NOT NULL, "col3_͉'1" BIT(22) NOT NULL, "c ol3_2" OID NULL, "col3_\\u44903" TSQUERY NOT NULL, col3_4 BOX2D NOT NULL, col3_5 STRING NOT NULL AS (CASE WHEN "c�ol3_0" IS NULL THEN e'\x11w^2\x12\x14\x06z':::STRING ELSE e'\x02\x02:\x1fL':::STRING END) VIRTUAL, INDEX ("c ol3_2" DESC, col3_5, col3_4 ASC, "col3_͉'1" DESC) WHERE table3.col3_5 != '':::STRING NOT VISIBLE);
    rsg_test.go:706: CREATE TABLE "tab\\x70le4" (col4_0 VARCHAR NOT NULL, "col4%p_1" STRING COLLATE da_DK NOT NULL, col4_2 UUID NOT NULL, co̅l4_3 VARCHAR NOT NULL, "'col}4_̚4" GEOMETRY, INDEX (col4_0, co̅l4_3 DESC, col4_2, "col4%p_1" DESC) STORING ("'col}4_̚4") WHERE ("tab\\x70le4".co̅l4_3 < '':::STRING) OR ("tab\\x70le4".col4_0 != e'\'':::STRING) NOT VISIBLE, INDEX (col4_0, col4_2 ASC, co̅l4_3, "col4%p_1" ASC) STORING ("'col}4_̚4"), INVERTED INDEX (col4_2 DESC, col4_0 ASC, "col4%p_1", "'col}4_̚4") WHERE ("tab\\x70le4".col4_0 != 'X':::STRING) AND ("tab\\x70le4".co̅l4_3 = e'\'':::STRING) VISIBILITY 0.26, INVERTED INDEX (co̅l4_3 ASC, col4_2 DESC, col4_0 gin_trgm_ops) WHERE "tab\\x70le4".co̅l4_3 != e'\U00002603':::STRING, INVERTED INDEX (col4_2 DESC, "'col}4_̚4") PARTITION BY LIST (col4_2) (PARTITION "tab\\x70le4_p art0" VALUES IN (('6e7c9ec7-45d8-4d0d-921e-76889e3314da':::UUID,), ('00000000-0000-0000-0000-000000000000':::UUID,)), PARTITION "tab\\x70le4_part1" VALUES IN (('e0748d48-bd38-4e92-83b7-2259073fba43':::UUID,), ('ae92da25-6ca3-4ead-bc20-8cb0593e50da':::UUID,)), PARTITION "tab\\x70le4_par�t\\u665F2" VALUES IN (('38b5ea44-8050-4715-82ca-1a7f56399d9d':::UUID,)), PARTITION "tab\*\x70le4_part3" VALUES IN (('da74619e-06e8-43eb-8b7b-a43a75347a0a':::UUID,), ('532d1eb0-834d-4ce0-aac8-62247707c980':::UUID,)), PARTITION "tab\\x70le4_part4" VALUES IN (('bc2acd03-cab9-4168-aa4b-9d49bafd5c39':::UUID,), ('6cb3bf06-fca1-45fc-b72e-ac0e1705af1b':::UUID,))), UNIQUE (col4_0) WHERE ("tab\\x70le4".col4_0 <= 'X':::STRING) AND ("tab\\x70le4".co̅l4_3 != 'X':::STRING), UNIQUE (co̅l4_3 ASC, col4_0, "col4%p_1" ASC, col4_2 ASC));
    rsg_test.go:706: ALTER TABLE "ta ble1" INJECT STATISTICS e'[{"avg_size": 4, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6347020907597482647, "histo_col_type": "", "name": "__auto__", "null_count": 4281911789475734708, "row_count": 7693100921215036680}, {"avg_size": 27, "columns": ["\\"col\'1_6\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7546045657913906329, "histo_col_type": "", "name": "__auto__", "null_count": 7204316911684682042, "row_count": 7693100921215036680}, {"avg_size": 19, "columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 407024034773842674, "histo_col_type": "", "name": "__auto__", "null_count": 6005078106372605041, "row_count": 7693100921215036680}, {"avg_size": 9, "columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2692856015032710634, "histo_col_type": "", "name": "__auto__", "null_count": 3151896938431079426, "row_count": 7693100921215036680}, {"avg_size": 12, "columns": ["\\"col1 _\\u000b10\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2458318201373244445, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7693100921215036680}, {"avg_size": 6, "columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2682112935765327247, "histo_col_type": "", "name": "__auto__", "null_count": 5686542867347087443, "row_count": 7693100921215036680}, {"avg_size": 26, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2412806583910481405, "histo_col_type": "", "name": "__auto__", "null_count": 1503894748805654227, "row_count": 7693100921215036680}, {"avg_size": 6, "columns": ["\\"co\\\\\\\\u62A8l1_3\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7186222142651814964, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7693100921215036680}, {"avg_size": 26, "columns": ["col\U0001F6231_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4586607315242903680, "histo_col_type": "", "name": "__auto__", "null_count": 1702401338916774426, "row_count": 7693100921215036680}, {"avg_size": 28, "columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4154405213681546975, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7693100921215036680}, {"avg_size": 8, "columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3698923748677131316, "histo_col_type": "", "name": "__auto__", "null_count": 6563720251843392075, "row_count": 7693100921215036680}, {"avg_size": 7, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 109020120308442442, "histo_col_type": "", "name": "__auto__", "null_count": 2323427276576524499, "row_count": 7693100921215036680}]':::JSONB;
    rsg_test.go:706: ALTER TABLE "t'a%pble2" INJECT STATISTICS e'[{"avg_size": 2, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7423143257238923130, "histo_buckets": [{"distinct_range": 0, "num_eq": 7000, "num_range": 0, "upper_bound": ""}, {"distinct_range": 700, "num_eq": 5471964765169354597, "num_range": 700, "upper_bound": "\\u0000"}, {"distinct_range": 0, "num_eq": 200000, "num_range": 1008200604925193802, "upper_bound": "\\u001aQ"}, {"distinct_range": 60000000000, "num_eq": 52836749218308075, "num_range": 60000000000, "upper_bound": "\'"}, {"distinct_range": 0, "num_eq": 6483685236104054888, "num_range": 5654582548239694595, "upper_bound": "9"}, {"distinct_range": 0, "num_eq": 7583760093531289273, "num_range": 5000, "upper_bound": "Yb%YC"}, {"distinct_range": 0, "num_eq": 0, "num_range": 700, "upper_bound": "{l|\\u0004\\u0010"}], "histo_col_type": "REFCURSOR", "name": "__auto__", "null_count": 0, "row_count": 8306026552360236617}, {"avg_size": 7, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7803662333789351326, "histo_buckets": [{"distinct_range": 0, "num_eq": 10000000, "num_range": 0, "upper_bound": "319006648"}, {"distinct_range": 3855986.7005966003, "num_eq": 700000, "num_range": 6000000, "upper_bound": "933059390"}, {"distinct_range": 146867969885382050, "num_eq": 5000000, "num_range": 868790463020029102, "upper_bound": "1874336848"}, {"distinct_range": 0, "num_eq": 500, "num_range": 30000000000, "upper_bound": "2418563618"}, {"distinct_range": 0, "num_eq": 303072571880667678, "num_range": 40000, "upper_bound": "3019548286"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 0, "row_count": 8306026552360236617}]':::JSONB;
    rsg_test.go:706: ALTER TABLE table3 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["\\"c\\u000bol3_0\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["\\"col3_\u0349\'1\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["\\"c ol3_2\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "OID", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["\\"col3_\\\\\\\\u44903\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}]':::JSONB;
    rsg_test.go:706: ALTER TABLE "tab\\x70le4" INJECT STATISTICS e'[{"avg_size": 30, "columns": ["col4_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 24459469, "histo_buckets": [{"distinct_range": 0, "num_eq": 1257977105905559647, "num_range": 0, "upper_bound": ""}, {"distinct_range": 0, "num_eq": 3450721932960609970, "num_range": 7000000, "upper_bound": "0e"}, {"distinct_range": 0, "num_eq": 2395899211827579723, "num_range": 10, "upper_bound": "N"}, {"distinct_range": 0, "num_eq": 6000000, "num_range": 3000000000, "upper_bound": "\U00002603"}], "histo_col_type": "VARCHAR", "name": "__auto__", "null_count": 0, "row_count": 600000000}, {"avg_size": 3, "columns": ["\\"col4%p_1\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 99330435, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 600000000}, {"avg_size": 1, "columns": ["col4_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 12813690, "histo_col_type": "UUID", "name": "__auto__", "null_count": 0, "row_count": 600000000}, {"avg_size": 31, "columns": ["co\u0305l4_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 322399310, "histo_col_type": "VARCHAR", "name": "__auto__", "null_count": 0, "row_count": 600000000}, {"avg_size": 30, "columns": ["\\"\'col}4_\u031A4\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 22799614, "histo_col_type": "", "name": "__auto__", "null_count": 394268142, "row_count": 600000000}]':::JSONB;
    rsg_test.go:706: CREATE TYPE rand_typ_0 AS ENUM ('vder', 'bvuesm');
    rsg_test.go:706: CREATE TYPE rand_typ_1 AS ENUM ('ilfxtu', 'w', 'krhk', 'bpvh');
    rsg_test.go:706: CREATE TYPE rand_typ_2 AS ENUM ('bnk', 'v', 'ukdzi');
    rsg_test.go:706: SET sql_safe_updates = false;;
    rsg_test.go:706: 
        BEGIN; CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning'); COMMIT;
        BEGIN;
        CREATE TABLE IF NOT EXISTS seed AS
            SELECT
                g::INT2 AS _int2,
                g::INT4 AS _int4,
                g::INT8 AS _int8,
                g::FLOAT4 AS _float4,
                g::FLOAT8 AS _float8,
                '2001-01-01'::DATE + g AS _date,
                '2001-01-01'::TIMESTAMP + g * '1 day'::INTERVAL AS _timestamp,
                '2001-01-01'::TIMESTAMPTZ + g * '1 day'::INTERVAL AS _timestamptz,
                g * '1 day'::INTERVAL AS _interval,
                g % 2 = 1 AS _bool,
                g::DECIMAL AS _decimal,
                g::STRING AS _string,
                g::STRING::BYTES AS _bytes,
                substring('00000000-0000-0000-0000-' || g::STRING || '00000000000', 1, 36)::UUID AS _uuid,
                '0.0.0.0'::INET + g AS _inet,
                g::STRING::JSONB AS _jsonb,
                enum_range('hello'::greeting)[g] as _enum
            FROM
                generate_series(1, 5) AS g;
        COMMIT;

        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:706: ALTER TABLE seed SPLIT AT VALUES (8061458868617246669);
    rsg_test.go:706: ALTER TABLE seed SPLIT AT VALUES (6565059763311953639);
    rsg_test.go:706: ALTER TABLE seed SPLIT AT VALUES (8824148704539712852);
    rsg_test.go:706: ALTER TABLE seed SCATTER;
    rsg_test.go:708: 
    rsg_test.go:709: -- test log scope end --
test logs left over in: /artifacts/tmp/_tmp/d437d2c847dfedbc4972f231c3331c8e/logTestRandomSyntaxSQLSmith113431122
--- FAIL: TestRandomSyntaxSQLSmith (371.06s)
Help

See also: [How To Investigate a Go Test Failure \(internal\)](https://cockroachlabs.atlassian.net/l/c/HgfXfJgM)

Same failure on other branches

- #112362 sql/tests: TestRandomSyntaxSQLSmith failed [C-test-failure O-robot T-sql-foundations branch-master release-blocker] - #111327 sql/tests: TestRandomSyntaxSQLSmith failed [NPE in applyJoinNode] [C-test-failure O-robot O-rsg T-sql-queries X-noreuse branch-master release-blocker]

/cc @cockroachdb/sql-foundations

This test on roachdash | Improve this report!

Jira issue: CRDB-32370

cockroach-teamcity commented 1 year ago

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on release-23.2 @ 87a94f6ac59d4e01c822bb2128db858176600dd6:

Random syntax error:

    rsg_test.go:895: Crash detected: server panic: pq: internal error: comparison overload not found (eq, refcursor, refcursor)

Query:

        WITH
            with93893 (col526049)
                AS (
                    SELECT
                        *
                    FROM
                        (VALUES (ARRAY['E6558707/FD7028D':::PG_LSN,'FFFFFFFF/FFFFFFFF':::PG_LSN])) AS "
        tAb 230515" (col526049)
                )
        SELECT
            "tab 230516".col3_0 AS col526050,
            "tab 230516"."%2acol3_2" AS "%qc'ol526051",
            "tab.230517".tableoid AS col526052,
            "tab 230516".crdb_internal_mvcc_timestamp AS "co
l526053",
            "tab.230517".col3_3 AS col526054,
            "tab 230516".col3_͓6 AS coͪl526055,
            e'\x00':::STRING AS col526056,
            "tab 230516".col3_5 AS "c\\U00092A66ol!526057",
            "tab.230517".tableoid AS col526058,
            3.560314341997628235E+22:::DECIMAL AS col526059,
            '00000000-0000-0000-0000-000000000000':::UUID AS col526060,
            (-12061):::INT8 AS col526061,
            "tab 230516".col3_3 AS "%qcol526062"
        FROM
            defaultdb.public.table3@"table3_col3_3_c%vol3_4_idx" AS "tab 230516"
            JOIN defaultdb.public.table3@"table3_col3_3_c%vol3_4_idx" AS "tab.230517" ON
                    ("tab 230516".col3_0) = ("tab.230517".col3_0) AND ("tab 230516".tableoid) = ("tab.230517".tableoid)
        WHERE
            true
        ORDER BY
            "tab.230517".crdb_internal_mvcc_timestamp ASC;

Schema:

    rsg_test.go:704: To reproduce, use schema:
    rsg_test.go:706: SET sql_safe_updates = false;;
    rsg_test.go:706: SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;;
    rsg_test.go:706: SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;;
    rsg_test.go:706: CREATE TABLE "ta%d0ble1" ("\\u32BBc\\u04F7ol1_ 0" BIT(22) NOT NULL, "c
        ol1_1" TSQUERY NOT NULL, col1_2 DATE NOT NULL, col1_3 STRING NOT NULL AS (lower(CAST("\\u32BBc\\u04F7ol1_   0" AS STRING))) VIRTUAL, INDEX (lower(CAST("c
        ol1_1" AS STRING)) DESC) NOT VISIBLE, INDEX (col1_3 DESC, col1_2 ASC) STORING ("\\u32BBc\\u04F7ol1_ 0"), FAMILY ("\\u32BBc\\u04F7ol1_   0"), FAMILY (col1_2, "c
        ol1_1"));
    rsg_test.go:706: CREATE TABLE table2 (col2_0 REGROLE, col2_1 STRING NOT NULL, col2_2 BIT(48) NOT NULL, "col2_\\x863" REFCURSOR NOT NULL, " c%vol2_4" GEOMETRY NULL, col2_5 BOX2D NOT NULL, col2_6 "char" NOT NULL, col2_7 GEOMETRY[] NOT NULL, col2_8 REFCURSOR NOT NULL, col2_9 TIMETZ NOT NULL, "col̩2\\U000BCFB5_10" STRING AS (CASE WHEN col2_0 IS NULL THEN e'C/KHT\x16\x15\x10':::STRING ELSE e'\U00002603':::STRING END) VIRTUAL, col2_11 STRING NOT NULL AS (lower(col2_6)) VIRTUAL, col2_12 STRING NOT NULL AS (lower(col2_6)) STORED, col2_13 STRING NOT NULL AS (lower(CAST(col2_8 AS STRING))) STORED, col̠2_14 STRING NOT NULL AS (lower(CAST(col2_5 AS STRING))) VIRTUAL);
    rsg_test.go:706: CREATE TABLE table3 (col3_0 OID NOT NULL, col3_1 UUID NOT NULL, "%2acol3_2" INT2 NOT NULL, col3_3 REFCURSOR NOT NULL, "c%vol3_4" STRING NULL AS (lower(CAST(col3_0 AS STRING))) VIRTUAL, col3_5 STRING NOT NULL AS (lower(CAST(col3_3 AS STRING))) VIRTUAL, col3_Í“6 INT8 NOT NULL AS ("%2acol3_2" + (-444):::INT8) VIRTUAL, PRIMARY KEY ("%2acol3_2" ASC, col3_3 DESC, col3_1 DESC, col3_0 ASC, col3_5 ASC, col3_Í“6 DESC), INDEX (col3_3 ASC, "c%vol3_4"), UNIQUE (col3_Í“6 ASC, col3_5 DESC, col3_1, "c%vol3_4" DESC, col3_3 ASC, "%2acol3_2" DESC), UNIQUE (col3_0));
    rsg_test.go:706: CREATE TABLE table4 ("c    ol4_0" "char" NOT NULL, col4_1 STRING COLLATE da_DK NOT NULL, "&col4_2" REGROLE NULL, "co'l 4_'3" NAME NOT NULL, col4_4 REGROLE NOT NULL, col4_5 STRING NOT NULL AS (lower("c   ol4_0")) VIRTUAL, col4_6 STRING NULL AS (CASE WHEN "&col4_2" IS NULL THEN e'\x0bOfbhkc%<':::STRING ELSE 'rY}':::STRING END) VIRTUAL, c̷ol4_7 STRING NULL AS (CASE WHEN "&col4_2" IS NULL THEN e'"\x17t':::STRING ELSE e'#\x0fct\x1b\x1b+*':::STRING END) STORED, "c%pol4_8" STRING NULL AS (CASE WHEN "&col4_2" IS NULL THEN e'jz/.3\x01\x1e':::STRING ELSE NULL END) VIRTUAL, PRIMARY KEY ("c  ol4_0" DESC, col4_4 ASC, col4_1 ASC), INDEX (col4_5 DESC) STORING ("&col4_2", "co'l 4_'3", c̷ol4_7) WHERE (((table4."c%pol4_8" = '"':::STRING) AND (table4.col4_5 != '':::STRING)) OR (table4."c    ol4_0" >= 'X':::STRING)) OR (table4."co'l 4_'3" < '"':::STRING:::NAME), UNIQUE (col4_6 DESC, "c ol4_0" DESC, "c%pol4_8", c̷ol4_7 DESC), INDEX (col4_1, "c%pol4_8") WHERE table4."c  ol4_0" = '':::STRING, INDEX (col4_6, "co'l 4_'3", c̷ol4_7 DESC, lower("c    ol4_0"), col4_5 DESC, "&col4_2" DESC), UNIQUE ("co'l 4_'3" ASC, "&col4_2", col4_4 ASC), UNIQUE (lower("co'l 4_'3") ASC) STORING ("&col4_2", "co'l 4_'3", c̷ol4_7) WHERE (((table4."co'l 4_'3" <= '':::STRING:::NAME) OR (table4."c  ol4_0" <= e'\U00002603':::STRING)) AND (table4."c%pol4_8" <= e'\x00':::STRING)) OR (table4.c̷ol4_7 <= '':::STRING), INDEX ("c%pol4_8" DESC, c̷ol4_7, col4_5 ASC, "co'l 4_'3" ASC, "c    ol4_0" DESC, "&col4_2", col4_1 ASC), INDEX ("&col4_2" DESC, lower("co'l 4_'3")) PARTITION BY LIST ("&col4_2") (PARTITION table4_part0 VALUES IN ((2801832633:::OID,), (793596059:::OID,), (803864447:::OID,)), PARTITION table4_part1 VALUES IN ((288683613:::OID,), (3942293345:::OID,), (3055434078:::OID,)), PARTITION table4_par̂t2 VALUES IN ((2577439743:::OID,), (3705063684:::OID,), (2694910810:::OID,)), PARTITION table4_part3 VALUES IN ((3929217429:::OID,), (298349092:::OID,), (246574293:::OID,)), PARTITION "
        table4_part4" VALUES IN ((0:::OID,), (84620605:::OID,)), PARTITION table4_part5 VALUES IN ((1431165045:::OID,), (4159822142:::OID,)), PARTITION "DEFAULT" VALUES IN ((DEFAULT,))) WHERE ((table4.col4_6 != '"':::STRING) AND (table4.col4_5 >= e'\U00002603':::STRING)) OR (table4."co'l 4_'3" > e'\'':::STRING:::NAME), FAMILY (cÌ·ol4_7, col4_4, "&col4_2", "c ol4_0", col4_1, "co'l 4_'3"));
    rsg_test.go:706: ALTER TABLE "ta%d0ble1" INJECT STATISTICS e'[{"avg_size": 0, "columns": ["\\"\\\\\\\\u32BBc\\\\\\\\u04F7ol1_\\t0\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["\\"c\\nol1_1\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_buckets": [{"distinct_range": 0, "num_eq": 200000, "num_range": 0, "upper_bound": "\\u0001M\\u000cN\\u0013/"}, {"distinct_range": 0, "num_eq": 6311713072292020039, "num_range": 0, "upper_bound": "%:cLc\\u0018"}, {"distinct_range": 1000, "num_eq": 90, "num_range": 1000, "upper_bound": ",8I[\\u0002"}, {"distinct_range": 1568630720441643000, "num_eq": 40000, "num_range": 1568630720441643073, "upper_bound": "_Kc\\u0016\\u001e|"}, {"distinct_range": 731461537240698800, "num_eq": 7708891751464121324, "num_range": 3880599823549283493, "upper_bound": "g)$6"}, {"distinct_range": 1000, "num_eq": 10000000000, "num_range": 1000, "upper_bound": "l"}, {"distinct_range": 334.79732587640245, "num_eq": 2139818734616900666, "num_range": 700, "upper_bound": "q+\\u0014"}, {"distinct_range": 400, "num_eq": 8311240585303528686, "num_range": 400, "upper_bound": "\U00002603"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 0}]':::JSONB;
    rsg_test.go:706: ALTER TABLE table2 INJECT STATISTICS e'[{"avg_size": 27, "columns": ["col\u03202_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6629515897, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}, {"avg_size": 20, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6620825097, "histo_col_type": "", "name": "__auto__", "null_count": 2320918287, "row_count": 7000000000}, {"avg_size": 24, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5021783582, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}, {"avg_size": 10, "columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1318497447, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}, {"avg_size": 21, "columns": ["\\"col\u03292\\\\\\\\U000BCFB5_10\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6229776445, "histo_col_type": "", "name": "__auto__", "null_count": 67489548, "row_count": 7000000000}, {"avg_size": 31, "columns": ["col2_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1802632620, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}, {"avg_size": 1, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5178313892, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}, {"avg_size": 22, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4765955081, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}, {"avg_size": 11, "columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2743261326, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}, {"avg_size": 15, "columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2590954618, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}, {"avg_size": 18, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4255005850, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}, {"avg_size": 13, "columns": ["\\"col2_\\\\\\\\x863\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2272965591, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}, {"avg_size": 20, "columns": ["col2_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1542631634, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}, {"avg_size": 30, "columns": ["\\" c%vol2_4\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4292072455, "histo_col_type": "", "name": "__auto__", "null_count": 6247488380, "row_count": 7000000000}, {"avg_size": 0, "columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2931776124, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7000000000}]':::JSONB;
    rsg_test.go:706: ALTER TABLE table3 INJECT STATISTICS e'[{"avg_size": 6, "columns": ["col3_\u03536"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 513, "histo_buckets": [{"distinct_range": 0, "num_eq": 5460380296424195359, "num_range": 0, "upper_bound": "-3742347844454796312"}, {"distinct_range": 5000000000, "num_eq": 8813763560253833863, "num_range": 5000000000, "upper_bound": "8766890635840128037"}], "histo_col_type": "INT8", "name": "__auto__", "null_count": 0, "row_count": 900}, {"avg_size": 3, "columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 262, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 900}, {"avg_size": 7, "columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 725, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 900}, {"avg_size": 11, "columns": ["\\"%2acol3_2\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 581, "histo_buckets": [{"distinct_range": 0, "num_eq": 70000000000, "num_range": 0, "upper_bound": "-12835"}, {"distinct_range": 0, "num_eq": 3000, "num_range": 7000000000, "upper_bound": "-544"}, {"distinct_range": 0, "num_eq": 2807064195222450936, "num_range": 500, "upper_bound": "7030"}, {"distinct_range": 108886.74678705339, "num_eq": 7491722443247558802, "num_range": 300000, "upper_bound": "8306"}, {"distinct_range": 6652735733.547132, "num_eq": 8520649044413472342, "num_range": 9000000000, "upper_bound": "13925"}, {"distinct_range": 2486294509786836500, "num_eq": 9000000000, "num_range": 4746673562172447154, "upper_bound": "19087"}, {"distinct_range": 52219.21893676398, "num_eq": 20000000000, "num_range": 500000, "upper_bound": "22476"}, {"distinct_range": 736677.6938130617, "num_eq": 50, "num_range": 2000000, "upper_bound": "26365"}, {"distinct_range": 0, "num_eq": 8504962980215296345, "num_range": 40000000, "upper_bound": "26420"}], "histo_col_type": "INT2", "name": "__auto__", "null_count": 0, "row_count": 900}, {"avg_size": 4, "columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 29, "histo_buckets": [{"distinct_range": 0, "num_eq": 50, "num_range": 0, "upper_bound": "\\u0000"}, {"distinct_range": 0, "num_eq": 1854831659875655592, "num_range": 0, "upper_bound": "\\u001c&"}, {"distinct_range": 310111.91911832045, "num_eq": 3000000000, "num_range": 400000, "upper_bound": "I5\\u0018%d*"}, {"distinct_range": 4499841269197244400, "num_eq": 50000, "num_range": 4499841269197244371, "upper_bound": "Rl\\u000b]M"}, {"distinct_range": 28534983.706885695, "num_eq": 5048389921604931405, "num_range": 40000000, "upper_bound": "X2{"}, {"distinct_range": 366506.9902340921, "num_eq": 4673566141961117187, "num_range": 800000, "upper_bound": "^"}, {"distinct_range": 0, "num_eq": 200, "num_range": 0, "upper_bound": "c-8"}], "histo_col_type": "REFCURSOR", "name": "__auto__", "null_count": 0, "row_count": 900}, {"avg_size": 9, "columns": ["\\"c%vol3_4\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 866, "histo_col_type": "", "name": "__auto__", "null_count": 798, "row_count": 900}, {"avg_size": 25, "columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 766, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 900}]':::JSONB;
    rsg_test.go:706: ALTER TABLE table4 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["\\"&col4_2\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["col4_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["col4_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_buckets": [{"distinct_range": 0, "num_eq": 7000000, "num_range": 0, "upper_bound": "e\\u000bx"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["col4_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["\\"co\'l 4_\'3\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_buckets": [{"distinct_range": 0, "num_eq": 7584674996388296071, "num_range": 0, "upper_bound": ""}, {"distinct_range": 900, "num_eq": 300, "num_range": 900, "upper_bound": "\\u0002K-]\\u0002\\u001b``*5"}, {"distinct_range": 0, "num_eq": 100000000, "num_range": 3705735591653588160, "upper_bound": "\\u00166}%_+"}, {"distinct_range": 0, "num_eq": 4000, "num_range": 400, "upper_bound": "G\\u0008[b+fTI["}, {"distinct_range": 17110190.277096156, "num_eq": 60000000000, "num_range": 100000000, "upper_bound": "Pg\\u001d\\u0003UN"}, {"distinct_range": 62070353.92306566, "num_eq": 0, "num_range": 500000000, "upper_bound": "gd]\\u0013^\\r=?"}, {"distinct_range": 188.73896269380214, "num_eq": 7511767772690601917, "num_range": 200, "upper_bound": "pOI,fKR"}], "histo_col_type": "NAME", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["col4_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["c\u0337ol4_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["\\"c%pol4_8\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_buckets": [{"distinct_range": 0, "num_eq": 3612900979555272610, "num_range": 0, "upper_bound": ""}, {"distinct_range": 0, "num_eq": 70000, "num_range": 0, "upper_bound": "\\u0000"}, {"distinct_range": 21254.83537743462, "num_eq": 60, "num_range": 70000, "upper_bound": "\\u0011\\u0006\\u001f%@o"}, {"distinct_range": 6447009673088923000, "num_eq": 0, "num_range": 6447009673088922816, "upper_bound": "9"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["\\"c\\tol4_0\\""], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_buckets": [{"distinct_range": 0, "num_eq": 6544387077727846207, "num_range": 0, "upper_bound": "\\u0011"}, {"distinct_range": 600000000, "num_eq": 3368691629165570530, "num_range": 600000000, "upper_bound": "&"}, {"distinct_range": 602797369065752000, "num_eq": 10000000, "num_range": 630259212325175670, "upper_bound": "\'"}, {"distinct_range": 80000000000, "num_eq": 3894556987820870094, "num_range": 80000000000, "upper_bound": "+"}, {"distinct_range": 0, "num_eq": 5725237206773819978, "num_range": 6000000, "upper_bound": "D"}, {"distinct_range": 6771996663220314000, "num_eq": 60000, "num_range": 7427952967356677366, "upper_bound": "]"}, {"distinct_range": 2232171662373995800, "num_eq": 6664710432964143552, "num_range": 6722211189554301465, "upper_bound": "u"}, {"distinct_range": 0, "num_eq": 0, "num_range": 10000000000, "upper_bound": "{"}], "histo_col_type": "\\"char\\"", "name": "__auto__", "null_count": 0, "row_count": 0}]':::JSONB;
    rsg_test.go:706: ALTER TABLE table2 ADD FOREIGN KEY (col2_0) REFERENCES table3 (col3_0);
    rsg_test.go:706: CREATE TYPE rand_typ_0 AS ENUM ('xxglj');
    rsg_test.go:706: SET sql_safe_updates = false;;
    rsg_test.go:706: 
        BEGIN; CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning'); COMMIT;
        BEGIN;
        CREATE TABLE IF NOT EXISTS seed AS
            SELECT
                g::INT2 AS _int2,
                g::INT4 AS _int4,
                g::INT8 AS _int8,
                g::FLOAT4 AS _float4,
                g::FLOAT8 AS _float8,
                '2001-01-01'::DATE + g AS _date,
                '2001-01-01'::TIMESTAMP + g * '1 day'::INTERVAL AS _timestamp,
                '2001-01-01'::TIMESTAMPTZ + g * '1 day'::INTERVAL AS _timestamptz,
                g * '1 day'::INTERVAL AS _interval,
                g % 2 = 1 AS _bool,
                g::DECIMAL AS _decimal,
                g::STRING AS _string,
                g::STRING::BYTES AS _bytes,
                substring('00000000-0000-0000-0000-' || g::STRING || '00000000000', 1, 36)::UUID AS _uuid,
                '0.0.0.0'::INET + g AS _inet,
                g::STRING::JSONB AS _jsonb,
                enum_range('hello'::greeting)[g] as _enum
            FROM
                generate_series(1, 5) AS g;
        COMMIT;

        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:708: 
    rsg_test.go:709: -- test log scope end --
--- FAIL: TestRandomSyntaxSQLSmith (370.54s)
Help

See also: [How To Investigate a Go Test Failure \(internal\)](https://cockroachlabs.atlassian.net/l/c/HgfXfJgM)

Same failure on other branches

- #112362 sql/tests: TestRandomSyntaxSQLSmith failed [C-test-failure O-robot T-sql-foundations branch-master release-blocker] - #111327 sql/tests: TestRandomSyntaxSQLSmith failed [NPE in applyJoinNode] [C-test-failure O-robot O-rsg T-sql-queries X-noreuse branch-master release-blocker]

This test on roachdash | Improve this report!

DrewKimball commented 1 year ago

Fixed by #112127