Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: internal error: expected *DJSON, found tree.dNull #70663

Closed
cockroach-teamcity opened this issue Sep 24, 2021 · 58 comments
Closed

sql: internal error: expected *DJSON, found tree.dNull #70663

cockroach-teamcity opened this issue Sep 24, 2021 · 58 comments
Assignees
Labels
branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-robot Originated from a bot. T-sql-queries SQL Queries Team

Comments

@cockroach-teamcity
Copy link
Member

cockroach-teamcity commented Sep 24, 2021

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 85b1e92455eb2795043d71e5766b1b56dab308f2:

Random syntax error:

    rsg_test.go:779: Crash detected: server panic: pq: internal error: no volatility for cast tuple[]::tuple{oid}[]

Query:

        WITH
        	with_22092 (col_133678) AS (SELECT * FROM (VALUES (4124365893:::OID)) AS tab_53995 (col_133678)),
        	with_22093 (col_133680)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							(
        								SELECT
        									ARRAY[(3094316761:::OID,)] AS col_133679
        								FROM
        									defaultdb.public.seed@[0] AS tab_53996
        								WHERE
        									false
        								ORDER BY
        									tab_53996._float8 DESC
        								LIMIT
        									1:::INT8
        							)
        						),
        						(ARRAY[(2507092097:::OID,),(0:::OID,),(756558269:::OID,)]),
        						(NULL),
        						(NULL),
        						(ARRAY[(963988552:::OID,),(NULL,)])
        				)
        					AS tab_53997 (col_133680)
        			EXCEPT
        				SELECT
        					*
        				FROM
        					(
        						VALUES
        							(ARRAY[]:::RECORD[]),
        							(NULL),
        							(ARRAY[(2900487383:::OID,)]),
        							(ARRAY[]:::RECORD[]),
        							(
        								ARRAY[(688555135:::OID,),(1531852639:::OID,),(179303289:::OID,),(1651224142:::OID,),(3924272170:::OID,)]
        							),
        							(ARRAY[(679193880:::OID,),(2446968155:::OID,),(3423303889:::OID,),(3663959049:::OID,)])
        					)
        						AS tab_53998 (col_133681)
        		),
        	with_22094 (col_133682, col_133683)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(3464715034:::OID, (-27553):::INT8),
        						(597561778:::OID, 29341:::INT8),
        						(
        							NULL,
        							CASE
        							WHEN false THEN 24700:::INT8
        							ELSE st_zmflag('010300000001000000040000000C461DB58577F0C1DA17FE0BCCE6E8C1A0BC3DCDB9FDF14100F6ADBD85849641424D3B954FC7F041AA06B4425AC801420C461DB58577F0C1DA17FE0BCCE6E8C1':::GEOMETRY::GEOMETRY)::INT2
        							END
        						)
        				)
        					AS tab_53999 (col_133682, col_133683)
        		)
        SELECT
        	ARRAY[(465901049:::OID,),(2680064326:::OID,),(2732701715:::OID,),(0:::OID,),(NULL,)] AS col_133684
        FROM
        	with_22093 AS cte_ref_6356
        ORDER BY
        	cte_ref_6356.col_133680 DESC
        LIMIT
        	51:::INT8;

Schema:

    rsg_test.go:596: To reproduce, use schema:
    rsg_test.go:598: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        		SET CLUSTER SETTING sql.defaults.interleaved_tables.enabled = true;
        	CREATE TABLE table1 (col1_0 REGCLASS NOT NULL, col1_1 INTERVAL NOT NULL, col1_2 FLOAT4, col1_3 BOOL, col1_4 INET NOT NULL, col1_5 BOOL, col1_6 TIMESTAMPTZ NULL, col1_7 VARCHAR, col1_8 "char", col1_9 TIME NULL, col1_10 REGCLASS, col1_11 REGNAMESPACE NOT NULL, col1_12 REGTYPE NOT NULL, col1_13 STRING NOT NULL, PRIMARY KEY (col1_1, col1_0 ASC, col1_13 ASC, col1_11 ASC), col1_14 STRING NULL AS (lower(CAST(col1_9 AS STRING))) STORED, col1_15 STRING NOT NULL AS (lower(CAST(col1_4 AS STRING))) STORED, col1_16 STRING NULL AS (CASE WHEN col1_6 IS NULL THEN e'\x0b_[]Z':::STRING ELSE e'o1!w.\x06\'':::STRING END) STORED, col1_17 STRING NOT NULL AS (lower(col1_13)) STORED, UNIQUE (col1_12, lower(CAST(col1_10 AS STRING)) DESC, col1_13 ASC, col1_4 DESC, col1_3 DESC, col1_7) STORING (col1_5, col1_6, col1_9, col1_15, col1_16), INDEX (col1_15 DESC, col1_9 DESC, col1_1, col1_16 DESC), UNIQUE (col1_3 DESC, col1_4 ASC, col1_11 ASC, col1_13) WHERE ((NOT table1.col1_5) AND (table1.col1_16 = e'\x00':::STRING)) AND (table1.col1_6 != '0001-01-01 00:00:00+00:00':::TIMESTAMPTZ), INDEX (col1_14 ASC, col1_8, col1_12, col1_10, col1_13, col1_6, col1_11 DESC, col1_3 ASC, col1_0 DESC, col1_1 DESC, col1_9 DESC, col1_17 DESC, col1_7, col1_5 ASC, lower(col1_13)), INDEX (col1_10 ASC, col1_11, lower(col1_8) ASC, col1_9 ASC, col1_15 ASC, col1_7, col1_4 DESC, col1_8 ASC) STORING (col1_3, col1_6), INDEX (lower(CAST(col1_4 AS STRING)), col1_1) WHERE (((((((((((table1.col1_13 < e'\x00':::STRING) AND (table1.col1_14 = e'\'':::STRING)) OR (table1.col1_8 != '':::STRING)) OR (table1.col1_7 > '"':::STRING)) OR (table1.col1_6 < '-2000-01-01 00:00:00+00:00':::TIMESTAMPTZ)) AND (table1.col1_9 != '24:00:00':::TIME)) AND table1.col1_3) OR table1.col1_5) OR (table1.col1_17 < e'\'':::STRING)) OR (table1.col1_15 = '"':::STRING)) OR (table1.col1_16 > 'X':::STRING)) OR (table1.col1_2 <= (-1.0):::FLOAT8), FAMILY (col1_15), FAMILY (col1_1), FAMILY (col1_8), FAMILY (col1_4), FAMILY (col1_6), FAMILY (col1_9), FAMILY (col1_16, col1_12, col1_3), FAMILY (col1_11), FAMILY (col1_10), FAMILY (col1_13), FAMILY (col1_5), FAMILY (col1_0, col1_7, col1_17), FAMILY (col1_14, col1_2));
        CREATE TABLE table2 (col2_0 TIMESTAMP NOT NULL, col2_1 "char" NOT NULL, col2_2 INT4 NULL, col2_3 DECIMAL NULL, col2_4 TIMESTAMP NULL, col2_5 TIMESTAMPTZ NOT NULL, col2_6 JSONB NULL, col2_7 GEOGRAPHY, col2_8 OID NULL, col2_9 INTERVAL, col2_10 CHAR, col2_11 JSONB NOT NULL, col2_12 REGPROC NOT NULL, col2_13 BOX2D, col2_14 STRING NOT NULL AS (lower(CAST(col2_11 AS STRING))) STORED, col2_15 STRING AS (lower(CAST(col2_13 AS STRING))) STORED, col2_16 STRING AS (lower(CAST(col2_9 AS STRING))) VIRTUAL, col2_17 STRING NULL AS (lower(CAST(col2_4 AS STRING))) VIRTUAL, INVERTED INDEX (lower(CAST(col2_4 AS STRING)) ASC, col2_7 ASC) WHERE ((((((table2.col2_16 != '"':::STRING) AND (table2.col2_0 <= '-4713-11-24 00:00:00':::TIMESTAMP)) OR (table2.col2_3 >= 1:::DECIMAL)) OR (table2.col2_15 < e'\'':::STRING)) OR (table2.col2_17 < e'\'':::STRING)) OR (table2.col2_14 > e'\U00002603':::STRING)) OR (table2.col2_2 > 32767:::INT8), INVERTED INDEX (col2_2 ASC, col2_13 ASC, col2_0, col2_16 DESC, col2_14 DESC, col2_17, col2_6), INDEX (col2_0 DESC, col2_15, col2_10) STORING (col2_6, col2_7, col2_8, col2_11, col2_13), INDEX (col2_9 ASC, col2_17 DESC, col2_4) STORING (col2_0, col2_1, col2_7, col2_8, col2_13, col2_15), UNIQUE (col2_1));
        ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 22562549847, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 40000000000}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 10216676632, "histo_col_type": "BOOL", "name": "__auto__", "null_count": 28333621757, "row_count": 40000000000}, {"columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 23987689115, "histo_col_type": "", "name": "__auto__", "null_count": 345568252, "row_count": 40000000000}, {"columns": ["col1_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 35865044636, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 40000000000}, {"columns": ["col1_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 28329492234, "histo_buckets": [{"distinct_range": 0, "num_eq": 4000000000, "num_range": 0, "upper_bound": "\\u0004\\"\\u00076%\\u000eI\\u0019"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 28248949204, "row_count": 40000000000}, {"columns": ["col1_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 12528488310, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 40000000000}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 15254941066, "histo_col_type": "", "name": "__auto__", "null_count": 17486921938, "row_count": 40000000000}, {"columns": ["col1_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 26630349385, "histo_buckets": [{"distinct_range": 0, "num_eq": 60000000, "num_range": 0, "upper_bound": "667044820"}, {"distinct_range": 0, "num_eq": 7000000000, "num_range": 4866614328731078000, "upper_bound": "2200577172"}, {"distinct_range": 0, "num_eq": 519076667440719499, "num_range": 3293998195691230240, "upper_bound": "2295102778"}], "histo_col_type": "REGTYPE", "name": "__auto__", "null_count": 0, "row_count": 40000000000}, {"columns": ["col1_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 31896697078, "histo_buckets": [{"distinct_range": 0, "num_eq": 6877082480766721361, "num_range": 0, "upper_bound": "8"}, {"distinct_range": 2461841112996175400, "num_eq": 8000000000, "num_range": 8684946611454311432, "upper_bound": "[R\'[R"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 40000000000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 17436258137, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 40000000000}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1919843317, "histo_col_type": "", "name": "__auto__", "null_count": 6299160867, "row_count": 40000000000}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 30596887379, "histo_col_type": "", "name": "__auto__", "null_count": 2849031256, "row_count": 40000000000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 32678022664, "histo_col_type": "", "name": "__auto__", "null_count": 25742861133, "row_count": 40000000000}, {"columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 22921931641, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 40000000000}, {"columns": ["col1_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7545001956, "histo_col_type": "", "name": "__auto__", "null_count": 11928157338, "row_count": 40000000000}, {"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 24165820087, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 40000000000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8215157302, "histo_col_type": "", "name": "__auto__", "null_count": 10546979335, "row_count": 40000000000}, {"columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 31283284314, "histo_col_type": "", "name": "__auto__", "null_count": 16125694728, "row_count": 40000000000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 430729251, "histo_col_type": "", "name": "__auto__", "null_count": 319573150, "row_count": 1000000000}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 837566359, "histo_col_type": "", "name": "__auto__", "null_count": 740110857, "row_count": 1000000000}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 383234667, "histo_col_type": "", "name": "__auto__", "null_count": 920689037, "row_count": 1000000000}, {"columns": ["col2_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 940776773, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000000}, {"columns": ["col2_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 787588083, "histo_col_type": "", "name": "__auto__", "null_count": 252103127, "row_count": 1000000000}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 369522606, "histo_col_type": "", "name": "__auto__", "null_count": 561397213, "row_count": 1000000000}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 417236283, "histo_buckets": [{"distinct_range": 0, "num_eq": 80000, "num_range": 0, "upper_bound": "-1254998480"}, {"distinct_range": 0, "num_eq": 5199263274049500917, "num_range": 100000000000, "upper_bound": "-126191361"}, {"distinct_range": 0, "num_eq": 600000, "num_range": 3210704078850259710, "upper_bound": "-9216801"}, {"distinct_range": 0, "num_eq": 1831799124136122947, "num_range": 2631528938018814614, "upper_bound": "0"}, {"distinct_range": 0, "num_eq": 900, "num_range": 80000000000, "upper_bound": "435718893"}, {"distinct_range": 0, "num_eq": 40000000000, "num_range": 0, "upper_bound": "1015546728"}, {"distinct_range": 0, "num_eq": 500000000, "num_range": 0, "upper_bound": "1144000714"}, {"distinct_range": 193005156.3151001, "num_eq": 2932598944005359114, "num_range": 200000000, "upper_bound": "1543410312"}], "histo_col_type": "INT4", "name": "__auto__", "null_count": 353958909, "row_count": 1000000000}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 288455059, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000000}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 292647693, "histo_col_type": "", "name": "__auto__", "null_count": 353101567, "row_count": 1000000000}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 489401842, "histo_buckets": [{"distinct_range": 0, "num_eq": 10000, "num_range": 0, "upper_bound": "-48 years -6 mons -938 days -09:50:48.335596"}], "histo_col_type": "INTERVAL", "name": "__auto__", "null_count": 370733233, "row_count": 1000000000}, {"columns": ["col2_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 223357411, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000000}, {"columns": ["col2_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 969544295, "histo_col_type": "", "name": "__auto__", "null_count": 479510289, "row_count": 1000000000}, {"columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 179111433, "histo_buckets": [{"distinct_range": 0, "num_eq": 8348843158999976916, "num_range": 0, "upper_bound": "1997-09-16 14:46:49.000555"}, {"distinct_range": 2487418476919924000, "num_eq": 8000, "num_range": 5349587970574729688, "upper_bound": "2017-01-01 18:00:48.000792"}, {"distinct_range": 1596387952549213400, "num_eq": 8000, "num_range": 1596387952549213488, "upper_bound": "2031-04-26 12:28:06.000631"}], "histo_col_type": "TIMESTAMP", "name": "__auto__", "null_count": 0, "row_count": 1000000000}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 103040275, "histo_col_type": "", "name": "__auto__", "null_count": 878425215, "row_count": 1000000000}, {"columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 687047136, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000000}, {"columns": ["col2_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 888961344, "histo_col_type": "", "name": "__auto__", "null_count": 84780854, "row_count": 1000000000}, {"columns": ["col2_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 587184099, "histo_col_type": "", "name": "__auto__", "null_count": 756888632, "row_count": 1000000000}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 807619097, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000000}]':::JSONB;
        ALTER TABLE table1 ADD FOREIGN KEY (col1_8) REFERENCES table2 (col2_1) ON DELETE CASCADE;
        CREATE TYPE rand_typ_0 AS ENUM ('c', 'pxgn', 'yyea', 'zrr', 'zhce');
        ;
    rsg_test.go:598: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:600: 
    rsg_test.go:601: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith238858753
--- FAIL: TestRandomSyntaxSQLSmith (300.90s)
Reproduce

To reproduce, try:

make stressrace TESTS=TestRandomSyntaxSQLSmith PKG=./pkg/sql/tests TESTTIMEOUT=5m STRESSFLAGS='-timeout 5m' 2>&1

Same failure on other branches

Internal log

mjibson marked as alumn{us/a}; resolving to rafiss instead

/cc @cockroachdb/sql-experience rafiss

This test on roachdash | Improve this report!

Jira issue: CRDB-10164

@cockroach-teamcity cockroach-teamcity added branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-robot Originated from a bot. labels Sep 24, 2021
@rafiss
Copy link
Collaborator

rafiss commented Sep 24, 2021

Full trace

ERROR: internal error: no volatility for cast tuple[]::tuple{oid}[]
SQLSTATE: XX000
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/sql/opt/memo/logical_props_builder.go:1601: BuildSharedProps()
github.com/cockroachdb/cockroach/pkg/sql/opt/memo/logical_props_builder.go:1525: buildProjectionsItemProps()
github.com/cockroachdb/cockroach/pkg/sql/opt/memo/expr.og.go:8578: PopulateProps()
github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:12239: ConstructProjectionsItem()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/project.go:55: constructProject()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/union.go:220: addCasts()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/union.go:56: buildSetOp()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/union.go:36: buildUnionClause()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:955: buildSelectStmtWithoutParens()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:924: func1()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/with.go:111: processWiths()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:923: buildSelect()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:275: buildStmt()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/with.go:187: buildCTE()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/with.go:135: buildCTEs()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/with.go:108: processWiths()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:923: buildSelect()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:275: buildStmt()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:235: buildStmtAtRoot()
github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:209: Build()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:521: buildExecMemo()
github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:194: makeOptimizerPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1259: makeExecPlan()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:970: dispatchToExecutionEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:708: execStmtInOpenState()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:129: execStmt()

I think we want to disallow casting between different arrays of tuples. We already disallow casting between tuples.

@rafiss
Copy link
Collaborator

rafiss commented Sep 24, 2021

Hm, actually I think we already disallow that cast. But the optimizer seems to be adding that cast anyway in

// addCasts adds a projection to a scope, adding casts as necessary so that the
// resulting columns have the given types.
func (b *Builder) addCasts(dst *scope, outTypes []*types.T) *scope {

But perhaps that's only because some other type-checking logic somewhere is incorrect. @rytaft would you be able to comment on whether this would be more of an optimizer fix or a type-checking fix?

@yuzefovich
Copy link
Member

I don't really know how this works, so I'll defer to @RaduBerinde and @rytaft.

An example repro is

SELECT * FROM (VALUES (ARRAY[(true, NULL)])) AS v1
  EXCEPT ALL SELECT * FROM (VALUES (ARRAY[]::RECORD[])) AS v2;

For reference, here is Postgres:

yuzefovich=# SELECT * FROM (VALUES (ARRAY[(true, NULL)])) AS v1
yuzefovich-#   EXCEPT ALL SELECT * FROM (VALUES (ARRAY[]::RECORD[])) AS v2;
 column1  
----------
 {"(t,)"}
(1 row)

@yuzefovich
Copy link
Member

Maybe @mgartner knows something too since he's be looking into the assignment casts recently.

@mgartner mgartner self-assigned this Sep 24, 2021
@rafiss
Copy link
Collaborator

rafiss commented Sep 25, 2021

The internal error: no volatility for cast tuple[]::tuple{oid}[] error also exists in v21.1.7 and v20.2.16 using that repro

SELECT * FROM (VALUES (ARRAY[(true, NULL)])) AS v1
  EXCEPT ALL SELECT * FROM (VALUES (ARRAY[]::RECORD[])) AS v2;

However, the query works correctly in v20.2.5. I ran a git bisect, and the first bad commit on the v20.2 branch is #61086. That is a backport of 4037bd8 which made it into v21.1.0. This commit deals with the addCasts function that I linked above.

@cockroach-teamcity

This comment has been minimized.

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 37d9f72a28a8e009bc6ba3c4d3c5780af554b92d:

Random syntax error:

    rsg_test.go:779: Crash detected: server panic: pq: internal error: no volatility for cast tuple[]::tuple{string, string, timestamp, interval}[]

Query:

        WITH
        	with_130792 (col_769284, col_769285)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							false,
        							'01060000A0E61000000900000001030000800100000008000000F7988C8BCBBE54C0F6B6BF72E84C4AC04412B0EA5D61F34190471A7DC69457406B40D8CAF0D44FC01034B7F35AB3F5C144E68E9289E85E40A705FD4EFDFD48C06D8119A65DF200C2A0C29CCE6559524038BCA12DC60B30C004F548D14CEFE7C1E6B00644CFBD65404009EF2D0D7DF7BFE00DF173BB5DDB4134E15E7039C45A4016F004432133534046B971D911F7F641DB2D1B08925E56C050132F3D28BA1AC02A36A9B49377EDC1F7988C8BCBBE54C0F6B6BF72E84C4AC04412B0EA5D61F3410103000080010000000A000000056767859BD85BC08090F6D662EA32C09CA0CB242FBB0142E225B15BE03461C01B57C5E1FEC745C004829B4135EFF641CAA6F7CD76B052403C38CF49273533C008E1E37A98E6FE41A4DCC138F5C85A4020FDE8B70B0903C0802128224E11D941686CC2FBA7866040B0E40F5F14C5554060F9BCAF3290E641B02CB36C4DFB2340926BB38AEBAE42408B90A57EA63BF8C1B0CAAEF4CAAB35C074D7137EA26D5040B8C8D523F364DFC13097934BD6DF27C0080D087DBC02434070709FDB39C9E241A601F06BAE7C54C0C858CF3F18444340D42DF811ECFC01C2056767859BD85BC08090F6D662EA32C09CA0CB242FBB01420103000080010000000A00000068D43C7095B143C0E06AAC292F643140145DAF34584FEE41DC70D493FFB85C40CB4D38F539FA52C0136C0B77769801C23CD54DB2B9D35740AED9DFA527F646C0EAFAB406EF2EF5414E9525296FE7624048CE17309D563B40601D0B899AC9B4C1685F3B98245E554030A91CB78A1F3E401471A2B2EB290142AA3F88FE4F4E4CC04E98993F5A015640C135554A1DAEF1C14CF1351BA1CA45C07037C8B5288B48407C2487D895AAE44186CEC50483FB58C0888D8F7971C449403638C74945F7F241416BFC14180D62C0606B481D1FCB4240B009B118E090D74168D43C7095B143C0E06AAC292F643140145DAF34584FEE41010300008001000000070000005145859B36D653C0C89AA987D8BD48C0B61F3DD49D60F3413887EF8B5AF632C08336E6DDDA5953C060015F68B8ADD841AC6BA3571B815040EFD3E5916F9F52C0B05F3FC925FCFF418433742254BD41402198453FDFAC49C080938E83E203DCC1C05F44C5FE4135C02C40D33878F93F403814D45871B2E041342BC2AD018865C0B09F4E43286644406CE6B75027C3F6C15145859B36D653C0C89AA987D8BD48C0B61F3DD49D60F341010300008001000000060000001B8A5AD9D04462C09067B2FC054729C0A88A424FE0F6D5C1D64955D9C3E8504028882F53161734C0B4820261D411E141F8AB714911834540A84A59505EE9304028E3D0769931FD412858349905134140EC4D88A3A3344640C0ADE5CF485EF5C1D5CF71CFABB655C0E410E4DE16A24B4034EECAB53006ECC11B8A5AD9D04462C09067B2FC054729C0A88A424FE0F6D5C10103000080010000000A000000BE0D16F2913063C03DC6CAF6333C4DC072B6F00D9BE4FAC16C06EC40063656C03CEE87B0348553C0F21419B61EBCE5C18BA135BE925A56C06ABDCC9FA07155C09DCD013121B7FDC1A0339DD9B58F2640D64C9E82250650C0361AF2F607ABE1C1108139F66EF146403F18D863A37A43C0D804C0251022FF414CB612C8ACD16240DE62EBC1AF5A3BC028CB8ABA8451E7418C95ECE5F92E5F4070327E4E8ACF1540301A3C0A860002C20CD6174F9FC25740CC2B4C49CBF44440B02E7EBD2506FD41AA55128270C561C028111B0374DB554090A04628DA4DD141BE0D16F2913063C03DC6CAF6333C4DC072B6F00D9BE4FAC10103000080010000000800000014D20AA4282463C01444ADB1CE9244C0202258194742FB41A9F7E0F1B29C62C0792F52883C6246C0B84A05B11CD8D8C1C79215D96D7255C0FC44DEFF1F8551C038FAE6398815FA41A03C3557C77342407B68A4C6C69C4FC0F6E052B5A69AF6413AB8A54051BB644000D63875FA8F44407440C36EFDC3E741BCF7AF3D629A464014AE4D3BD1D13A402013353AE89AE8C1643CF126C1624CC06494A1AF187251401C838CC5F548FD4114D20AA4282463C01444ADB1CE9244C0202258194742FB410103000080010000000B00000090748700178149C01ABCF9DAD56F53C0382D1CF79D58D9C1644BC6E8425749C0F6E239771F4B54C06499CA05A8D1FBC110FB36EC4AD23DC0EA13A4E9198653C0A8C079DF862EE641A43683ABAF41604082086B1D580651C0D60A1F01A472014208BC7A9178275040F07FE623D6112F40C669272E4A16F0415872336FDB2B5A40E4EC70B3197E54400056D8E1ABF07DC110CD8665FDD33340B86770E22E424940F44F833D0D8CF9C1B8E444FCC91838C0DC43A7FF2B5F4B401A17A517CB2EEAC1A0D64DB18EE532C05C0A95246C0547408004B9D437CEA0C1A34F1CF0941A51C0BA958BC7A30556404CA2C66F82F4DDC190748700178149C01ABCF9DAD56F53C0382D1CF79D58D9C1010300008001000000090000009F6CFD55C54262C0DE276E1D5D3F50C000F83B4FA018D34162B1F0685AE75CC08E07BFC5C75851C0A0606C3503EBF6412065768A16D43C40FA72639DA20A3CC01852EF833CB6EE410C4FE58FC1295F40A70EF22E6C7043C0543E7FC79640E8C1ECA9343E43425F408029A37A729BEEBFF2E0977103C8FFC11EE90CB363D26540F6B507F85508424090E875156724FD41F004FB07D4185040600676E7CC365640A47A8DEDB8A6D8C1D4027B9CF8634940C83FD662D68D51401C5B1B8312A6FF419F6CFD55C54262C0DE276E1D5D3F50C000F83B4FA018D341':::GEOGRAPHY
        						),
        						(false, NULL),
        						(NULL, NULL),
        						(false, '0103000060E610000000000000':::GEOGRAPHY),
        						(
        							false,
        							'0102000060E610000003000000F889C3322B8C63403812C18D0C7F454030F6C3F8B6DACAC1342FC1472ADD4C40F87C5BC653E43240DACFFCCA922EEBC1DC590F4951284F4004FD1D3FA5074D40E41864439045FB41':::GEOGRAPHY
        						)
        				)
        					AS tab_320426 (col_769284, col_769285)
        		),
        	with_130793 (col_769287, col_769288)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							ARRAY[('#':::STRING, '&':::STRING, '2032-08-23 21:31:44.000035':::TIMESTAMP, '41 years 11 mons 529 days 08:03:24.274493':::INTERVAL)],
        							2243426674:::OID
        						),
        						(
        							ARRAY[('A':::STRING, NULL, '2023-07-23 19:00:51.00085':::TIMESTAMP, '44 years 5 mons 4 days 17:13:24.603873':::INTERVAL),('Y':::STRING, '0':::STRING, '1990-06-29 20:35:08.00052':::TIMESTAMP, '-64 years -1 mons -502 days -04:04:34.547109':::INTERVAL),(NULL, '@':::STRING, '2023-12-10 12:49:17.000676':::TIMESTAMP, '-59 years -7 mons -392 days -16:53:31.104231':::INTERVAL)],
        							0:::OID
        						),
        						(
        							NULL,
        							(
        								SELECT
        									tab_320427.tableoid AS col_769286
        								FROM
        									defaultdb.public.seed@seed__int8__float8__date_idx AS tab_320427
        								WHERE
        									false
        								ORDER BY
        									tab_320427._int2 ASC
        								LIMIT
        									1:::INT8
        							)
        						),
        						(
        							CASE
        							WHEN false
        							THEN ARRAY[('!':::STRING, ';':::STRING, '2025-09-27 17:03:47.000442':::TIMESTAMP, '1 day':::INTERVAL)]
        							ELSE ARRAY[]:::RECORD[]
        							END,
        							786683693:::OID
        						),
        						(
        							ARRAY[(e'\x04':::STRING, e'\r':::STRING, '1971-11-14 04:50:05.000597':::TIMESTAMP, '-72 years -515 days -16:48:11.650306':::INTERVAL),('S':::STRING, e'\f':::STRING, '2021-07-31 07:38:24.000178':::TIMESTAMP, '1 mon 1 day':::INTERVAL)],
        							2470907454:::OID
        						)
        				)
        					AS tab_320428 (col_769287, col_769288)
        		),
        	with_130794 (col_769289)
        		AS (
        			SELECT
        				*
        			FROM
        				(VALUES (e'\\\x15':::STRING), (NULL), ('hYL>qH':::STRING), (e'*$u5j\x05':::STRING), (NULL))
        					AS tab_320429 (col_769289)
        		)
        SELECT
        	cte_ref_38160.col_769289 AS col_769290, NULL AS col_769291
        FROM
        	with_130792 AS cte_ref_38159, with_130794 AS cte_ref_38160, with_130793 AS cte_ref_38161
        WHERE
        	NULL;

Schema:

    rsg_test.go:596: To reproduce, use schema:
    rsg_test.go:598: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        		SET CLUSTER SETTING sql.defaults.interleaved_tables.enabled = true;
        	CREATE TABLE table1 (col1_0 REGCLASS NOT NULL, col1_1 CHAR NOT NULL, col1_2 REGCLASS NOT NULL, col1_3 OID, col1_4 VARCHAR, col1_5 REGPROCEDURE NOT NULL, col1_6 BOX2D NOT NULL, PRIMARY KEY (col1_1 ASC, col1_2 ASC, col1_0 DESC, col1_6, col1_5), col1_7 STRING NOT NULL AS (lower(CAST(col1_5 AS STRING))) VIRTUAL, INDEX (lower(col1_4) ASC, col1_5 DESC, col1_3 ASC, col1_6 DESC, col1_1 DESC, col1_2 DESC, col1_4 ASC, lower(col1_4) DESC), INDEX (col1_7, col1_0 ASC, col1_4, col1_6 ASC), INDEX (col1_7 ASC, col1_4 DESC, col1_0 DESC, col1_3, lower(col1_4), col1_5, col1_1 DESC) WHERE ((table1.col1_4 < '"':::STRING) AND (table1.col1_7 = '':::STRING)) AND (table1.col1_1 > e'\'':::STRING), INDEX (col1_3, col1_7, col1_2, col1_6 DESC, col1_1 DESC, col1_0 ASC, col1_4 ASC) WHERE ((table1.col1_1 < e'\U00002603':::STRING) OR (table1.col1_4 > e'\U00002603':::STRING)) OR (table1.col1_7 != e'\U00002603':::STRING), INDEX (col1_4 ASC, col1_6 DESC, col1_5 DESC, col1_1 DESC, col1_7 DESC, col1_0 DESC) WHERE ((table1.col1_4 > '"':::STRING) OR (table1.col1_1 != '':::STRING)) AND (table1.col1_7 <= '"':::STRING), UNIQUE (col1_0, col1_6, col1_7) STORING (col1_4) WHERE ((table1.col1_7 >= 'X':::STRING) OR (table1.col1_4 < '':::STRING)) AND (table1.col1_1 > e'\U00002603':::STRING), INDEX (col1_6 ASC) STORING (col1_3) WHERE ((table1.col1_4 = '"':::STRING) OR (table1.col1_1 >= e'\'':::STRING)) OR (table1.col1_7 != e'\x00':::STRING));
        ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 38658, "histo_buckets": [{"distinct_range": 0, "num_eq": 800000000, "num_range": 0, "upper_bound": "\\t"}, {"distinct_range": 8408072804881280000, "num_eq": 20000000, "num_range": 8408072804881279683, "upper_bound": "\\u0010"}, {"distinct_range": 0, "num_eq": 2273094361282410233, "num_range": 1346163822964280192, "upper_bound": "\\u0016"}, {"distinct_range": 0, "num_eq": 153964964183816830, "num_range": 0, "upper_bound": "!"}, {"distinct_range": 1292181226794648600, "num_eq": 5857557742878504509, "num_range": 1467359992715884707, "upper_bound": "]"}, {"distinct_range": 0, "num_eq": 6816042297334574092, "num_range": 628445781254131735, "upper_bound": "j"}, {"distinct_range": 214766.21864577985, "num_eq": 8000, "num_range": 600000, "upper_bound": "\U00002603"}], "histo_col_type": "CHAR", "name": "__auto__", "null_count": 0, "row_count": 90000}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 85875, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 90000}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 25196, "histo_buckets": [{"distinct_range": 0, "num_eq": 900, "num_range": 0, "upper_bound": "496309302"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 54056, "row_count": 90000}, {"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 79788, "histo_buckets": [{"distinct_range": 0, "num_eq": 8000, "num_range": 0, "upper_bound": ""}, {"distinct_range": 0, "num_eq": 900000, "num_range": 7515985054954827783, "upper_bound": "\\u0003a-\\u0016"}, {"distinct_range": 1000, "num_eq": 60000000000, "num_range": 1000, "upper_bound": "\\u0013J+h\\u000c\\u0012x\\u001c\\t"}, {"distinct_range": 0, "num_eq": 2793475864285176521, "num_range": 600, "upper_bound": "\\"V[R"}, {"distinct_range": 0, "num_eq": 2254064806910408905, "num_range": 0, "upper_bound": "\'"}, {"distinct_range": 1687.234198049641, "num_eq": 9086170648280956566, "num_range": 2000, "upper_bound": "@yp4WT"}, {"distinct_range": 1914521517210885600, "num_eq": 9038138570397936988, "num_range": 5036686570979057651, "upper_bound": "q.1i\\tl\\u0015s"}, {"distinct_range": 5333696343350224000, "num_eq": 7000, "num_range": 6791131434446407663, "upper_bound": "vF,\\u0011\\t"}], "histo_col_type": "VARCHAR", "name": "__auto__", "null_count": 4465, "row_count": 90000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 26883, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 90000}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4898, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 90000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1924, "histo_buckets": [{"distinct_range": 0, "num_eq": 8205624440332261145, "num_range": 0, "upper_bound": "\\rSIv\\tD\\u0005\\u0005"}, {"distinct_range": 700, "num_eq": 400854453748757325, "num_range": 700, "upper_bound": "\\u0015^H4px^"}, {"distinct_range": 0, "num_eq": 90000, "num_range": 7000, "upper_bound": "\\u0016$b"}, {"distinct_range": 38321359384.48381, "num_eq": 40000000, "num_range": 50000000000, "upper_bound": "\\u001f0U|b\\u0012I<z"}, {"distinct_range": 0, "num_eq": 4000000, "num_range": 5036000356791451205, "upper_bound": ".A\x7f\\u0010\\u0010Y(4."}, {"distinct_range": 0, "num_eq": 315321040120107381, "num_range": 600, "upper_bound": ">wd"}, {"distinct_range": 1950128834395872800, "num_eq": 4265494904444582709, "num_range": 4493762310985042560, "upper_bound": "\\\\V+XSu"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 90000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 43854, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 90000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('enzhdb', 'tn', 'sb');
        CREATE TYPE rand_typ_1 AS ENUM ('nuics', 'dwutt', 'z', 'p');
        ;
    rsg_test.go:598: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:600: 
    rsg_test.go:601: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith049003739
--- FAIL: TestRandomSyntaxSQLSmith (300.83s)
Reproduce

To reproduce, try:

make stressrace TESTS=TestRandomSyntaxSQLSmith PKG=./pkg/sql/tests TESTTIMEOUT=5m STRESSFLAGS='-timeout 5m' 2>&1

Same failure on other branches

Internal log

mjibson marked as alumn{us/a}; resolving to rafiss instead

/cc @cockroachdb/sql-experience rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 80844e44f4f9d0e565c6e810bd4c782be61899bf:

Random syntax error:

    rsg_test.go:779: Crash detected: server panic: pq: internal error: no volatility for cast tuple[]::tuple{timestamp, int, oid}[]

Query:

        WITH
        	with_83045 (col_488636)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						('932c23e0-2bf2-4396-b7bc-369122553bfc':::UUID),
        						('89c38dea-b0c1-45a8-8290-978d90602970':::UUID),
        						(uuid_generate_v4()::UUID)
        				)
        					AS tab_202573 (col_488636)
        		),
        	with_83051 (col_488637)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							ARRAY[('1977-06-27 12:21:02.00072':::TIMESTAMP, (-97):::INT8, 1864683891:::OID),('-2000-01-01 00:00:00':::TIMESTAMP, (-1):::INT8, 523665172:::OID)]
        						),
        						(
        							ARRAY[('2008-11-29 02:40:51.000305':::TIMESTAMP, NULL, 2292942868:::OID),('2022-03-06 23:12:27.000805':::TIMESTAMP, (-6882):::INT8, 2927181995:::OID)]
        						),
        						(
        							ARRAY[('2022-08-17 11:58:55.000855':::TIMESTAMP, 8428:::INT8, 544693792:::OID),('1996-03-31 03:43:09.000014':::TIMESTAMP, (-25376):::INT8, 3818103243:::OID),('1990-10-22 22:10:41.000942':::TIMESTAMP, (-12636):::INT8, 3879743942:::OID),('1992-01-22 22:00:15.000937':::TIMESTAMP, (-11167):::INT8, 1946845898:::OID),('1980-06-27 13:13:45.000014':::TIMESTAMP, (-1):::INT8, 1274223841:::OID)]
        						)
        				)
        					AS tab_202574 (col_488637)
        			UNION
        				SELECT
        					*
        				FROM
        					(
        						VALUES
        							(ARRAY[]:::RECORD[]),
        							(
        								ARRAY[('-2000-01-01 00:00:00':::TIMESTAMP, (-677):::INT8, 2761097027:::OID),('2029-06-14 19:33:17.000133':::TIMESTAMP, 4248:::INT8, 1417626654:::OID),('1999-01-29 22:03:33.000135':::TIMESTAMP, 18243:::INT8, 1472105147:::OID),('2018-08-24 13:26:42.000156':::TIMESTAMP, 1:::INT8, NULL)]
        							),
        							(ARRAY[]:::RECORD[]),
        							(ARRAY[]:::RECORD[]),
        							(
        								ARRAY[('2012-06-05 04:15:48.000855':::TIMESTAMP, 1:::INT8, 2673110924:::OID),('2012-12-28 22:47:53.000823':::TIMESTAMP, 0:::INT8, 317170978:::OID),(NULL, 7486:::INT8, 4091016392:::OID),('1985-08-07 02:01:33.000304':::TIMESTAMP, 25259:::INT8, 1360838344:::OID),('2015-04-18 19:26:26.00011':::TIMESTAMP, 1:::INT8, 1137148570:::OID),('2014-12-28 02:42:13.000242':::TIMESTAMP, 10700:::INT8, NULL)]
        							),
        							(
        								(
        									WITH
        										with_83046 (col_488638, col_488639)
        											AS (
        												SELECT
        													*
        												FROM
        													(
        														VALUES
        															(
        																'morning':::greeting,
        																'ea5fa113-e2f5-48c2-b575-5492d9a5ae23':::UUID
        															)
        													)
        														AS tab_202575 (col_488638, col_488639)
        											),
        										with_83047 (col_488640)
        											AS (SELECT * FROM (VALUES (0:::DECIMAL)) AS tab_202576 (col_488640))
        									SELECT
        										ARRAY[('2032-11-25 06:04:02.000515':::TIMESTAMP, (-20287):::INT8, NULL),('1992-10-03 08:42:26.000465':::TIMESTAMP, (-1811):::INT8, 2019312865:::OID),(NULL, (-1407):::INT8, 4063965708:::OID)]
        											AS col_488645
        									FROM
        										defaultdb.public.table1@[0] AS tab_202577,
        										defaultdb.public.seed@[0] AS tab_202578
        									LIMIT
        										1:::INT8
        								)
        							)
        					)
        						AS tab_202582 (col_488646)
        			UNION
        				SELECT
        					*
        				FROM
        					(
        						VALUES
        							(ARRAY[('2008-09-07 23:03:45.000074':::TIMESTAMP, 11833:::INT8, 0:::OID)]),
        							(
        								ARRAY[('1972-08-07 01:23:49.000146':::TIMESTAMP, NULL, 840028580:::OID),('1975-05-21 15:25:05.000722':::TIMESTAMP, (-21980):::INT8, 2516219074:::OID)]
        							),
        							(
        								ARRAY[('2027-07-28 13:45:24.00068':::TIMESTAMP, 1:::INT8, 3724620443:::OID),('1982-04-28 21:51:43.000163':::TIMESTAMP, (-16483):::INT8, 2452880402:::OID)]
        							),
        							(
        								ARRAY[('1988-06-16 06:07:20.000237':::TIMESTAMP, NULL, 2676926084:::OID),('1995-12-23 20:10:28.000786':::TIMESTAMP, (-19321):::INT8, 4028734843:::OID),(NULL, 23425:::INT8, 2455340398:::OID)]
        							),
        							(NULL)
        					)
        						AS tab_202583 (col_488647)
        				INTERSECT
        					SELECT
        						*

Schema:

    rsg_test.go:596: To reproduce, use schema:
    rsg_test.go:598: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        		SET CLUSTER SETTING sql.defaults.interleaved_tables.enabled = true;
        	CREATE TABLE table1 (col1_0 INT4 NOT NULL, col1_1 INT8 NOT NULL, col1_2 TIME, col1_3 BOOL NOT NULL, col1_4 REGPROCEDURE, col1_5 TIMETZ NOT NULL, PRIMARY KEY (col1_5 DESC), col1_6 STRING AS (lower(CAST(col1_4 AS STRING))) STORED, col1_7 INT4 NOT NULL AS (col1_0 + (-58861978):::INT8) STORED, INDEX ((col1_0 + col1_1) ASC, col1_2 ASC, col1_1 DESC, col1_0, col1_4 DESC), INDEX (col1_5 DESC) STORING (col1_1, col1_3, col1_4, col1_6, col1_7) WHERE ((((((table1.col1_5 > '24:00:00-15:59:00':::TIMETZ) AND (table1.col1_2 <= '00:00:00':::TIME)) OR (table1.col1_7 >= 0:::INT8)) AND table1.col1_3) OR (table1.col1_0 != (-1):::INT8)) OR (table1.col1_6 < '"':::STRING)) OR (table1.col1_1 != (-32768):::INT8), UNIQUE (col1_3, col1_1, (col1_1 + col1_0)) STORING (col1_0, col1_4, col1_6, col1_7), UNIQUE (col1_6, (col1_1 + col1_0) ASC) STORING (col1_2, col1_3, col1_4), INDEX (col1_3 ASC, col1_7 ASC, col1_5 DESC, col1_4, (col1_0 + col1_1) DESC, col1_0, col1_2 ASC, col1_1 DESC) STORING (col1_6), INDEX (col1_4), INDEX (col1_6, lower(CAST(col1_3 AS STRING)) DESC, col1_1 ASC) WHERE ((((table1.col1_7 < (-1):::INT8) AND (NOT table1.col1_3)) AND (table1.col1_0 > 32767:::INT8)) OR (table1.col1_6 >= e'\U00002603':::STRING)) OR (table1.col1_5 = '24:00:00-15:59:00':::TIMETZ), FAMILY (col1_6), FAMILY (col1_7, col1_4), FAMILY (col1_2, col1_3), FAMILY (col1_5), FAMILY (col1_0), FAMILY (col1_1));
        ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 596997112, "histo_buckets": [{"distinct_range": 0, "num_eq": 5579331340323690963, "num_range": 0, "upper_bound": "4182185671"}], "histo_col_type": "REGPROCEDURE", "name": "__auto__", "null_count": 389791900, "row_count": 900000000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 840050778, "histo_buckets": [{"distinct_range": 0, "num_eq": 6766249216660900759, "num_range": 0, "upper_bound": "00:00:00+15:59:00"}, {"distinct_range": 0, "num_eq": 1000000000, "num_range": 0, "upper_bound": "05:25:17.285152+11:00:00"}, {"distinct_range": 579493991428735400, "num_eq": 3477720277897146586, "num_range": 2802940995147087842, "upper_bound": "02:26:01.380404+07:38:00"}, {"distinct_range": 54073.739751221205, "num_eq": 5586813325985024517, "num_range": 80000, "upper_bound": "17:49:35.659355+07:17:00"}, {"distinct_range": 0, "num_eq": 7508906605441652120, "num_range": 2812208955004219935, "upper_bound": "19:20:46.731042-00:11:00"}, {"distinct_range": 90000000000, "num_eq": 10000, "num_range": 90000000000, "upper_bound": "16:49:52.694113-09:23:00"}], "histo_col_type": "TIMETZ", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 627152479, "histo_buckets": [{"distinct_range": 0, "num_eq": 2000, "num_range": 0, "upper_bound": "\\r\\u000eW"}, {"distinct_range": 746970052107486500, "num_eq": 70000000, "num_range": 910110197992475399, "upper_bound": ";ME]Mj``\\\\L"}, {"distinct_range": 0, "num_eq": 3852641031928848385, "num_range": 0, "upper_bound": "e\\u0003u."}, {"distinct_range": 0, "num_eq": 3000000000, "num_range": 0, "upper_bound": "q9UgN@\\u001cy\\u0019"}, {"distinct_range": 0, "num_eq": 289066546885769482, "num_range": 9011110403687748508, "upper_bound": "\U00002603"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 499433393, "row_count": 900000000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 270911975, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 534776895, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 489180430, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 581744859, "histo_col_type": "", "name": "__auto__", "null_count": 370393592, "row_count": 900000000}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 227346554, "histo_col_type": "BOOL", "name": "__auto__", "null_count": 0, "row_count": 900000000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('ui', 'zwuwmv', 'm', 'qihloz', 'oq');
        CREATE TYPE rand_typ_1 AS ENUM ('pbgsul', 'k', 'wtzz', 'bv');
        CREATE TYPE rand_typ_2 AS ENUM ('mwccm');
        CREATE TYPE rand_typ_3 AS ENUM ('vy', 'cvbnd', 'jou', 'aorqqq');
        ;
    rsg_test.go:598: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:600: 
    rsg_test.go:601: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith627946742
--- FAIL: TestRandomSyntaxSQLSmith (326.74s)
Reproduce

To reproduce, try:

make stressrace TESTS=TestRandomSyntaxSQLSmith PKG=./pkg/sql/tests TESTTIMEOUT=5m STRESSFLAGS='-timeout 5m' 2>&1

Same failure on other branches

Internal log

mjibson marked as alumn{us/a}; resolving to rafiss instead

/cc @cockroachdb/sql-experience rafiss

This test on roachdash | Improve this report!

@rafiss
Copy link
Collaborator

rafiss commented Sep 28, 2021

Filed #70831 to track the bug separately from this test.

@cockroach-teamcity

This comment has been minimized.

@cockroach-teamcity

This comment has been minimized.

@cockroach-teamcity

This comment has been minimized.

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 1fc4fc1493eb4bb521b2ffb6f7904891395f4b47:

Random syntax error:

    rsg_test.go:779: Crash detected: server panic: pq: internal error: no volatility for cast tuple[]::tuple{int}[]

Query:

        SELECT
        	jsonb_agg(tab_307362.col3_13)::JSONB AS col_688334
        FROM
        	defaultdb.public.seed AS tab_307360
        	JOIN defaultdb.public.seed AS tab_307361 ON (tab_307360._jsonb) = (tab_307361._jsonb),
        	defaultdb.public.table3@[0] AS tab_307362
        WHERE
        	crdb_internal.reset_multi_region_zone_configs_for_database((WITH with_126071 (col_688328, col_688329) AS (SELECT * FROM (VALUES (ARRAY[]:::OID[], COALESCE((WITH with_126069 (col_688324) AS (SELECT * FROM (VALUES (2948664571:::OID)) AS tab_307363 (col_688324)), with_126070 (col_688325, col_688326) AS (SELECT * FROM (VALUES (1475174682:::OID, ARRAY[(-9681):::INT8]), (NULL, COALESCE(CASE WHEN true THEN ARRAY[16507:::INT8,(-9242):::INT8,(-30171):::INT8,(-128):::INT8,(-10164):::INT8] ELSE ARRAY[22266:::INT8] END, ARRAY[14488:::INT8,15974:::INT8,(-3142):::INT8,(-15369):::INT8,(-6179):::INT8,(-7415):::INT8])), (693698660:::OID, ARRAY[(-25896):::INT8,(-5761):::INT8,(-7207):::INT8]), (3350483394:::OID, ARRAY[(-15596):::INT8,(-17637):::INT8,20031:::INT8,(-26055):::INT8]), (99078562:::OID, ARRAY[11805:::INT8])) AS tab_307364 (col_688325, col_688326)) SELECT DISTINCT ARRAY[((-3280821113292579368):::INT8,),(4142958483866476035:::INT8,),(NULL,)] AS col_688327 FROM with_126070 AS cte_ref_36721 LIMIT 1:::INT8), ARRAY[]:::RECORD[])), (ARRAY[2440091191:::OID], ARRAY[(5606700332448661972:::INT8,),((-683345978653447562):::INT8,),((-4772286268642893622):::INT8,),(857285277962429976:::INT8,),((-2699983019726104079):::INT8,),((-2998677528196021969):::INT8,)]), (ARRAY[3450079149:::OID,1885176109:::OID,176694860:::OID,2973798158:::OID,1324541887:::OID], ARRAY[(9186473876090084625:::INT8,),((-3384509414499897356):::INT8,),((-3577451827515537861):::INT8,)]), (NULL, NULL), (NULL, ARRAY[((-3050388886260773837):::INT8,)])) AS tab_307365 (col_688328, col_688329)), with_126072 (col_688330) AS (SELECT * FROM (VALUES ('1987-07-05 02:31:39.000301':::TIMESTAMP), ('1977-01-11 18:42:09.000829':::TIMESTAMP), (NULL), (('22:27:13.629016':::TIME::TIME + '1994-11-22':::DATE::DATE)::TIMESTAMP), ('1992-01-26 14:16:20.000187':::TIMESTAMP)) AS tab_307366 (col_688330)), with_126073 (col_688331, col_688332) AS (SELECT * FROM (VALUES (e'\x03':::STRING, false)) AS tab_307367 (col_688331, col_688332)) SELECT NULL AS col_688333 FROM with_126072 AS cte_ref_36722, defaultdb.public.table2@table2_col2_2_key AS tab_307368, defaultdb.public.seed@seed__int8__float8__date_idx AS tab_307369 LIMIT 1:::INT8)::INT8)::BOOL
        GROUP BY
        	tab_307360._jsonb, tab_307362.col3_8, tab_307362.col3_13
        HAVING
        	bool_or(false::BOOL)::BOOL
        LIMIT
        	70:::INT8;

Schema:

    rsg_test.go:596: To reproduce, use schema:
    rsg_test.go:598: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        		SET CLUSTER SETTING sql.defaults.interleaved_tables.enabled = true;
        	CREATE TABLE table1 (col1_0 TIME NOT NULL, col1_1 INTERVAL, UNIQUE (col1_1, col1_0 ASC), INDEX (col1_0, col1_1), UNIQUE (col1_1 DESC) WHERE table1.col1_0 >= '24:00:00':::TIME, FAMILY (col1_1), FAMILY (col1_0));
        CREATE TABLE table2 (col2_0 UUID NOT NULL, col2_1 STRING NOT NULL, col2_2 REGROLE NOT NULL, PRIMARY KEY (col2_2 DESC, col2_1), col2_3 STRING NOT NULL AS (lower(CAST(col2_0 AS STRING))) STORED, UNIQUE (col2_2 DESC) WHERE (table2.col2_1 >= e'\U00002603':::STRING) AND (table2.col2_3 < '"':::STRING), UNIQUE (lower(CAST(col2_0 AS STRING)) DESC, col2_3, col2_1 DESC, lower(CAST(col2_0 AS STRING)) DESC) WHERE (table2.col2_3 = e'\U00002603':::STRING) AND (table2.col2_1 >= e'\U00002603':::STRING));
        CREATE TABLE table3 (col3_0 TIME NOT NULL, col3_1 TIMETZ NOT NULL, col3_2 JSONB, col3_3 UUID, col3_4 BIT, col3_5 INT4 NULL, col3_6 CHAR NOT NULL, col3_7 NAME NOT NULL, col3_8 BOX2D NOT NULL, col3_9 REGCLASS, col3_10 BOX2D NULL, col3_11 TIMETZ NOT NULL, col3_12 OID, col3_13 NAME NOT NULL, col3_14 STRING NOT NULL AS (lower(col3_13)) VIRTUAL, col3_15 STRING NOT NULL AS (lower(col3_7)) VIRTUAL, UNIQUE (col3_6, col3_0 ASC, col3_11 ASC, col3_4 DESC, col3_13, col3_14, col3_1, col3_5 DESC) WHERE table3.col3_15 <= e'\'':::STRING, INDEX (lower(col3_13) ASC, col3_7 DESC, col3_4 DESC, col3_5, col3_13 ASC, col3_15, col3_14 DESC, col3_9 ASC, col3_12 DESC, col3_10, col3_11 ASC, col3_1 ASC, col3_8 DESC, col3_0 DESC) STORING (col3_3, col3_6) WHERE ((((((((table3.col3_14 <= e'\x00':::STRING) OR (table3.col3_6 = e'\x00':::STRING)) AND (table3.col3_0 >= '00:00:00':::TIME)) OR (table3.col3_11 >= '00:00:00+15:59:00':::TIMETZ)) AND (table3.col3_7 = e'\x00':::STRING)) AND (table3.col3_15 < e'\'':::STRING)) OR (table3.col3_5 < 1:::INT8)) AND (table3.col3_1 >= '00:00:00+15:59:00':::TIMETZ)) OR (table3.col3_13 < '':::STRING), FAMILY (col3_9, col3_10), FAMILY (col3_6), FAMILY (col3_12, col3_0, col3_7), FAMILY (col3_4, col3_1, col3_5, col3_2, col3_8, col3_3, col3_11, col3_13));
        ALTER TABLE table1 INJECT STATISTICS '[{"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 12, "histo_buckets": [{"distinct_range": 0, "num_eq": 6981788596688906266, "num_range": 0, "upper_bound": "06:39:35.925549"}, {"distinct_range": 566.9222883770005, "num_eq": 100000, "num_range": 1000, "upper_bound": "12:20:12.625061"}, {"distinct_range": 10, "num_eq": 3367641439968188647, "num_range": 10, "upper_bound": "19:04:36.263982"}, {"distinct_range": 30000, "num_eq": 1000, "num_range": 30000, "upper_bound": "23:52:44.391992"}], "histo_col_type": "TIME", "name": "__auto__", "null_count": 0, "row_count": 70}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 29, "histo_buckets": [{"distinct_range": 0, "num_eq": 4851098299787565425, "num_range": 0, "upper_bound": "-63 years -5 mons -416 days -11:25:42.401853"}, {"distinct_range": 3375282927237684700, "num_eq": 3062700487912619199, "num_range": 3375282927237684851, "upper_bound": "-58 years -3 mons -614 days -03:57:15.832951"}, {"distinct_range": 0, "num_eq": 2162957637693947304, "num_range": 20000, "upper_bound": "-57 years -10 mons -600 days -08:15:10.838499"}, {"distinct_range": 231433704692892480, "num_eq": 8634603913244060599, "num_range": 252637087099768140, "upper_bound": "-26 years -9 mons -280 days -04:11:27.908032"}, {"distinct_range": 2321262056.280009, "num_eq": 5000000000, "num_range": 8000000000, "upper_bound": "57 years 7 mons 212 days 11:42:12.764392"}, {"distinct_range": 1984578222544269300, "num_eq": 0, "num_range": 3511319064213016353, "upper_bound": "69 years 2 mons 325 days 05:27:41.663348"}, {"distinct_range": 3833439870250695000, "num_eq": 3596027804199540298, "num_range": 3833439870250695317, "upper_bound": "290 years"}], "histo_col_type": "INTERVAL", "name": "__auto__", "null_count": 39, "row_count": 70}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 346398827186856694, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2063350943142031123}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1523484535750449574, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2063350943142031123}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 923359867242260970, "histo_buckets": [{"distinct_range": 0, "num_eq": 3000000000, "num_range": 0, "upper_bound": "279576081"}, {"distinct_range": 3171936636.4079394, "num_eq": 5000000, "num_range": 10000000000, "upper_bound": "683718786"}, {"distinct_range": 0, "num_eq": 1000000, "num_range": 1144872054250485942, "upper_bound": "2113773910"}, {"distinct_range": 200000000, "num_eq": 900000000, "num_range": 200000000, "upper_bound": "2507126959"}, {"distinct_range": 80000000000, "num_eq": 5984351257675709295, "num_range": 80000000000, "upper_bound": "2775842992"}, {"distinct_range": 0, "num_eq": 7886989247869998204, "num_range": 10000, "upper_bound": "2879095459"}, {"distinct_range": 0, "num_eq": 30000, "num_range": 8048709857375817835, "upper_bound": "3043045048"}, {"distinct_range": 178063658441484160, "num_eq": 100, "num_range": 1028565112992460305, "upper_bound": "3112145157"}, {"distinct_range": 2367187019941896000, "num_eq": 400000, "num_range": 5786043542134245532, "upper_bound": "3552495351"}], "histo_col_type": "REGROLE", "name": "__auto__", "null_count": 0, "row_count": 2063350943142031123}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1895268296376632018, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2063350943142031123}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS e'[{"columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 525, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 335, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 806, "histo_col_type": "", "name": "__auto__", "null_count": 222, "row_count": 1000}, {"columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 240, "histo_col_type": "", "name": "__auto__", "null_count": 750, "row_count": 1000}, {"columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 554, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 708, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 280, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 777, "histo_col_type": "", "name": "__auto__", "null_count": 937, "row_count": 1000}, {"columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 243, "histo_col_type": "", "name": "__auto__", "null_count": 648, "row_count": 1000}, {"columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 445, "histo_col_type": "", "name": "__auto__", "null_count": 660, "row_count": 1000}, {"columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 144, "histo_buckets": [{"distinct_range": 0, "num_eq": 8149394373837140257, "num_range": 0, "upper_bound": "\\u0000"}, {"distinct_range": 0, "num_eq": 1000000000, "num_range": 1734811309033939070, "upper_bound": "$"}, {"distinct_range": 70000000, "num_eq": 0, "num_range": 70000000, "upper_bound": "\'"}, {"distinct_range": 427.98937428321375, "num_eq": 700000, "num_range": 800, "upper_bound": "8"}, {"distinct_range": 2197952575154712800, "num_eq": 500000, "num_range": 5739907458914715533, "upper_bound": "N"}, {"distinct_range": 0, "num_eq": 400000, "num_range": 8000000, "upper_bound": "O"}, {"distinct_range": 2378840603617812500, "num_eq": 10000000000, "num_range": 2378840603617812724, "upper_bound": "h"}, {"distinct_range": 864743.4590929889, "num_eq": 80000000, "num_range": 1000000, "upper_bound": "p"}], "histo_col_type": "CHAR", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 408, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 487, "histo_col_type": "", "name": "__auto__", "null_count": 31, "row_count": 1000}, {"columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 255, "histo_col_type": "", "name": "__auto__", "null_count": 46, "row_count": 1000}, {"columns": ["col3_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 255, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col3_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 544, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('xtmj', 'du', 'wqch', 'fhzsh', 'au');
        CREATE TYPE rand_typ_1 AS ENUM ('wgnek', 'spfy', 'nclx', 'k', 'wzoc');
        CREATE TYPE rand_typ_2 AS ENUM ('um', 'vspl');
        CREATE TYPE rand_typ_3 AS ENUM ('eke', 'jijcnp', 'thme', 'whfu', 'g', 'bog');
        CREATE TYPE rand_typ_4 AS ENUM ('dl', 'sj', 'uvtogw', 'sw', 'gfk', 'jsoxu');
        ;
    rsg_test.go:598: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:600: 
    rsg_test.go:601: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith929185346
--- FAIL: TestRandomSyntaxSQLSmith (351.24s)
Reproduce

To reproduce, try:

make stressrace TESTS=TestRandomSyntaxSQLSmith PKG=./pkg/sql/tests TESTTIMEOUT=5m STRESSFLAGS='-timeout 5m' 2>&1

Same failure on other branches

Internal log

mjibson marked as alumn{us/a}; resolving to rafiss instead

/cc @cockroachdb/sql-experience rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity

This comment has been minimized.

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 9013165fa81c4cddbe38b73c8b429faa3de226e3:

Random syntax error:

    rsg_test.go:779: Crash detected: server panic: pq: internal error: no volatility for cast tuple[]::tuple{oid, jsonb}[]

Query:

        WITH
        	with_222104 (col_1314602, col_1314603, col_1314604, col_1314605, col_1314606)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							NULL,
        							'\xe29883':::BYTES,
        							0.44640197535567605:::FLOAT8,
        							'\xa76ea7d79b1f8c':::BYTES,
        							3387382287:::OID
        						)
        				)
        					AS tab_541654 (col_1314602, col_1314603, col_1314604, col_1314605, col_1314606)
        		),
        	with_222105 (col_1314607)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							COALESCE(
        								ARRAY[(3835978134:::OID, '[true, "G<(1;guuZAi", 0.512819857967245, {}, []]':::JSONB),(3259571040:::OID, e'{"&#l,=R^*XEK": {"-hs\\\\": null, "Ligjj": {}, "\\\\}\'$tl": ["e^?YM< 7VW", [[{}], {" bl": {}}, false]]}, "a": [0.3166215227861005]}':::JSONB)],
        								NULL
        							)
        						),
        						(ARRAY[]:::RECORD[])
        				)
        					AS tab_541655 (col_1314607)
        			INTERSECT ALL
        				SELECT
        					*
        				FROM
        					(
        						VALUES
        							(ARRAY[]:::RECORD[]),
        							(
        								ARRAY[(1365064785:::OID, e'[{"\'d@G8[D5rA?|": true, "Zdstb4": [null], "a": {"\\\\^~yeC": {"foobar": {}}, "b": [{}]}, "c": 3.6830691585587254}, [[[]]], [], {"pfwk&2Kq": {}}]':::JSONB)]
        							),
        							(
        								ARRAY[(4049111486:::OID, e'{"!.d": {"bar": [], "c\\"jj<[(5_Z$": ["baz", {">7w5p": null, ">N\'in:Ro;": [], "bar": [")W)4/*"]}, {"c": true}, {}]}, "g1s": [[], {}]}':::JSONB)]
        							),
        							(
        								ARRAY[(NULL, '[{"Fuxt+``grTByn": [], "b": {"a": []}, "bar": {"foo": "baz", "}xT": null}}, [["c"], [], [{}, [1.2529366818179066]]]]':::JSONB)]
        							)
        					)
        						AS tab_541656 (col_1314608)
        		),
        	with_222106 (col_1314609)
        		AS (
        			SELECT
        				*
        			FROM
        				(VALUES (3325630049:::OID), (3647629203:::OID), (2956803552:::OID)) AS tab_541657 (col_1314609)
        			EXCEPT ALL
        				SELECT
        					*
        				FROM
        					(
        						VALUES
        							(
        								(
        									SELECT
        										676175425:::OID AS col_1314611
        									FROM
        										defaultdb.public.table1@primary AS tab_541659
        									WHERE
        										false
        									ORDER BY
        										tab_541659.col1_12 DESC
        									LIMIT
        										1:::INT8
        								)
        							),
        							(2085478123:::OID),
        							(4197208373:::OID),
        							(NULL),
        							(1441496226:::OID),
        							(4239868185:::OID)
        					)
        						AS tab_541660 (col_1314612)
        		)
        SELECT
        	NULL AS col_1314613,
        	tab_541661._float8 AS col_1314614,
        	tab_541661._float4 AS col_1314615,
        	tab_541661._string AS col_1314616
        FROM
        	defaultdb.public.seed@seed__int8__float8__date_idx AS tab_541661
        WHERE
        	true
        ORDER BY
        	tab_541661._int2, tab_541661._float4 ASC, tab_541661._bytes DESC
        LIMIT
        	96:::INT8;

Schema:

    rsg_test.go:596: To reproduce, use schema:
    rsg_test.go:598: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        		SET CLUSTER SETTING sql.defaults.interleaved_tables.enabled = true;
        	CREATE TABLE table1 (col1_0 REGROLE NULL, col1_1 DECIMAL, col1_2 INT4 NULL, col1_3 TIME NULL, col1_4 INTERVAL NOT NULL, col1_5 GEOMETRY, col1_6 BOX2D NULL, col1_7 INT2 NOT NULL, col1_8 INET NOT NULL, col1_9 REGPROC NOT NULL, col1_10 FLOAT4, col1_11 "char", PRIMARY KEY (col1_4 DESC), col1_12 STRING NULL AS (lower(CAST(col1_0 AS STRING))) VIRTUAL, INVERTED INDEX (col1_3 ASC, col1_2 ASC, col1_4 DESC, col1_8 DESC, col1_0 DESC, col1_5 ASC) WHERE table1.col1_7 > 1:::INT8, FAMILY (col1_4), FAMILY (col1_7, col1_3), FAMILY (col1_11), FAMILY (col1_5), FAMILY (col1_9, col1_2), FAMILY (col1_0), FAMILY (col1_10, col1_6), FAMILY (col1_8), FAMILY (col1_1));
        ALTER TABLE table1 INJECT STATISTICS '[{"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 257478894233785324, "histo_buckets": [{"distinct_range": 0, "num_eq": 3255060927702213652, "num_range": 0, "upper_bound": "-60 years -4 mons -280 days -01:34:25.017803"}, {"distinct_range": 6000000000, "num_eq": 2125350936684030094, "num_range": 6000000000, "upper_bound": "-43 years -5 mons -545 days -20:28:29.207839"}, {"distinct_range": 246.81685963777207, "num_eq": 3000000000, "num_range": 500, "upper_bound": "1 day"}, {"distinct_range": 60000000, "num_eq": 7480231966786761071, "num_range": 60000000, "upper_bound": "7 years 4 mons 424 days 03:18:46.323483"}, {"distinct_range": 0, "num_eq": 7403942733074520480, "num_range": 900000000, "upper_bound": "66 years 2 mons 158 days 10:17:06.718844"}], "histo_col_type": "INTERVAL", "name": "__auto__", "null_count": 0, "row_count": 368337577815392087}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 38244880926555481, "histo_col_type": "", "name": "__auto__", "null_count": 200389432140492051, "row_count": 368337577815392087}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 12013204245381020, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 368337577815392087}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 79463837858499850, "histo_col_type": "", "name": "__auto__", "null_count": 78586109360171072, "row_count": 368337577815392087}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 315868658860899147, "histo_col_type": "", "name": "__auto__", "null_count": 56576905372963194, "row_count": 368337577815392087}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 265189193277743533, "histo_col_type": "", "name": "__auto__", "null_count": 297011691395502963, "row_count": 368337577815392087}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 338357082681995584, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 368337577815392087}, {"columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 24968970730581748, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 368337577815392087}, {"columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 285544807129198061, "histo_col_type": "", "name": "__auto__", "null_count": 67747869072928248, "row_count": 368337577815392087}, {"columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 317199759304447814, "histo_col_type": "", "name": "__auto__", "null_count": 84143475993493604, "row_count": 368337577815392087}, {"columns": ["col1_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 134973544260380384, "histo_col_type": "", "name": "__auto__", "null_count": 72744658725921180, "row_count": 368337577815392087}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 337028744278576084, "histo_col_type": "", "name": "__auto__", "null_count": 146201403534523791, "row_count": 368337577815392087}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 165679111880797242, "histo_col_type": "", "name": "__auto__", "null_count": 329483570638004796, "row_count": 368337577815392087}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('wo', 'djhsz', 'ea', 'jvnq', 'ehkdfv');
        CREATE TYPE rand_typ_1 AS ENUM ('yh', 'jdsarp', 'rbunwl', 's', 'umggv');
        CREATE TYPE rand_typ_2 AS ENUM ('qruf', 'iitbw', 'kd');
        CREATE TYPE rand_typ_3 AS ENUM ('va', 'p', 'vyxo', 'vlno');
        ;
    rsg_test.go:598: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:600: 
    rsg_test.go:601: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith819999014
--- FAIL: TestRandomSyntaxSQLSmith (300.96s)
Reproduce

To reproduce, try:

make stressrace TESTS=TestRandomSyntaxSQLSmith PKG=./pkg/sql/tests TESTTIMEOUT=5m STRESSFLAGS='-timeout 5m' 2>&1

Same failure on other branches

Internal log

mjibson marked as alumn{us/a}; resolving to rafiss instead

/cc @cockroachdb/sql-experience rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 5ac733bb4927020bc1c52da24b2591742fde8e1f:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: ordering column group (4,11) contains non-equivalent columns (op project)

Query:

        SELECT
        	st_mpolyfromtext(tab_571967.col1_3::STRING)::GEOMETRY AS col_1298029, tab_571968.col1_3 AS col_1298030
        FROM
        	defaultdb.public.table1 AS tab_571967
        	JOIN defaultdb.public.table1 AS tab_571968 ON
        			(tab_571967.col1_0) = (tab_571968.col1_0) AND (tab_571967.col1_3) = (tab_571968.col1_3),
        	defaultdb.public.table2@[0] AS tab_571969
        	JOIN defaultdb.public.seed@[0] AS tab_571970 ON false
        ORDER BY
        	tab_571967.col1_3 DESC, tab_571969.col2_13;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 INET NOT NULL, col1_1 VARCHAR NOT NULL, col1_2 BOOL NOT NULL, col1_3 STRING NOT NULL AS (lower(CAST(col1_2 AS STRING))) STORED, PRIMARY KEY (col1_0, col1_2 ASC, col1_1 DESC, col1_3 ASC), UNIQUE (col1_2 DESC, col1_3, col1_1 ASC, col1_0 DESC), INDEX (col1_3), UNIQUE (col1_1, col1_2 DESC) WHERE ((table1.col1_1 >= e'\U00002603':::STRING) AND table1.col1_2) OR (table1.col1_3 != 'X':::STRING), INDEX (col1_1 ASC, lower(CAST(col1_2 AS STRING)) ASC), UNIQUE (col1_1 ASC, col1_3 DESC) WHERE ((table1.col1_1 > '"':::STRING) OR (NOT table1.col1_2)) AND (table1.col1_3 = '"':::STRING), UNIQUE (col1_0 ASC));
        CREATE TABLE table2 (col2_0 UUID, col2_1 INT4, col2_2 INT4 NOT NULL, col2_3 INT8 NOT NULL, col2_4 REGCLASS, col2_5 FLOAT8 NOT NULL, col2_6 BYTES NOT NULL, col2_7 INT2 NULL, col2_8 INT4, col2_9 GEOMETRY NULL, col2_10 FLOAT8, col2_11 REGROLE NULL, col2_12 REGCLASS NOT NULL, col2_13 INT4 AS (((col2_8 + col2_2) + col2_1) + col2_3) VIRTUAL, UNIQUE (col2_1 DESC, col2_10 ASC, col2_5 DESC, col2_3 ASC, col2_0 ASC, col2_13 ASC, col2_4 ASC, col2_11 DESC, col2_6, col2_7 DESC), INDEX (col2_10 ASC, col2_13 DESC, lower(CAST(col2_12 AS STRING)) DESC, col2_0 DESC, (col2_1 + (-1762646881):::INT8) ASC, col2_7, col2_5, col2_8 ASC, col2_4, col2_6 ASC, (col2_5 + 0.3314406729933667:::FLOAT8) ASC, col2_3 ASC, col2_11, col2_1 ASC) STORING (col2_2, col2_9, col2_12), INVERTED INDEX (col2_1 ASC, col2_12 ASC, col2_11 DESC, col2_10, col2_2 DESC, col2_4, (((col2_3 + col2_2) + col2_1) + col2_8), col2_9) WHERE ((table2.col2_3 = 2147483647:::INT8) AND (table2.col2_8 = 0:::INT8)) OR (table2.col2_13 <= 1:::INT8), FAMILY (col2_3, col2_7, col2_0), FAMILY (col2_12, col2_4, col2_8, col2_2, col2_11, col2_10), FAMILY (col2_9), FAMILY (col2_1), FAMILY (col2_6, col2_5));
        CREATE TABLE table3 (col3_0 DATE NOT NULL, col3_1 OID NULL, col3_2 INET NULL, col3_3 TIMESTAMPTZ NULL, col3_4 STRING NULL AS (lower(CAST(col3_1 AS STRING))) STORED, col3_5 STRING NULL AS (CASE WHEN col3_3 IS NULL THEN '':::STRING ELSE e'-\x132\x15dIJL':::STRING END) VIRTUAL, PRIMARY KEY (col3_0 DESC), INDEX (col3_4 ASC) WHERE table3.col3_3 >= '3000-01-01 00:00:00+00:00':::TIMESTAMPTZ, INDEX (col3_2, col3_1 ASC, col3_5 ASC, col3_4 ASC), UNIQUE (col3_4 DESC, col3_0 DESC) WHERE ((table3.col3_0 <= 'infinity':::DATE) OR (table3.col3_4 >= e'\U00002603':::STRING)) OR (table3.col3_3 = '-2000-01-01 00:00:00+00:00':::TIMESTAMPTZ), INDEX (col3_2 DESC, col3_3 DESC, col3_5), INDEX (col3_3 ASC, col3_1 DESC, col3_4 DESC) STORING (col3_2), INDEX (col3_2, col3_1 DESC, col3_5, col3_4 ASC), INDEX (col3_0 ASC, col3_5 DESC, col3_3 ASC, (CASE WHEN col3_3 IS NULL THEN e'/[=hn/\x19^':::STRING ELSE e'4\x06k@':::STRING END), col3_4));
        ALTER TABLE table1 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "INET", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_buckets": [{"distinct_range": 0, "num_eq": 2674223195479844685, "num_range": 0, "upper_bound": ""}], "histo_col_type": "VARCHAR", "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": 5170967104840240862, "num_range": 0, "upper_bound": "\\u0007|2.}l"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 0}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 62599754032, "histo_buckets": [{"distinct_range": 0, "num_eq": 8323410361688824726, "num_range": 0, "upper_bound": "-2031465299"}, {"distinct_range": 0, "num_eq": 500000, "num_range": 3000, "upper_bound": "-1764908802"}, {"distinct_range": 0, "num_eq": 3463131039547202341, "num_range": 400000, "upper_bound": "-1328069862"}, {"distinct_range": 4063286079714403000, "num_eq": 100, "num_range": 4063286079714402597, "upper_bound": "-755986082"}, {"distinct_range": 0, "num_eq": 50000, "num_range": 4050874813368844706, "upper_bound": "-692861813"}, {"distinct_range": 70000000000, "num_eq": 90, "num_range": 70000000000, "upper_bound": "707262152"}, {"distinct_range": 0, "num_eq": 4000000000, "num_range": 5953515428145091856, "upper_bound": "1082660009"}, {"distinct_range": 0, "num_eq": 800, "num_range": 611082525489011135, "upper_bound": "1353867531"}, {"distinct_range": 5531140282193392000, "num_eq": 200000000, "num_range": 5531140282193391879, "upper_bound": "1654779447"}], "histo_col_type": "INT4", "name": "__auto__", "null_count": 67899571821, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 24240091017, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4398540585, "histo_col_type": "", "name": "__auto__", "null_count": 58632480038, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 18985209304, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 82314246722, "histo_col_type": "", "name": "__auto__", "null_count": 38264076323, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 51442246727, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 61842641555, "histo_col_type": "", "name": "__auto__", "null_count": 24472754715, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 18913348768, "histo_col_type": "", "name": "__auto__", "null_count": 7301748396, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 94644683230, "histo_col_type": "", "name": "__auto__", "null_count": 56503371938, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 77543914943, "histo_col_type": "", "name": "__auto__", "null_count": 74189067974, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 68192301911, "histo_buckets": [{"distinct_range": 0, "num_eq": 1310486462285608706, "num_range": 0, "upper_bound": "-1.9250995264854922"}, {"distinct_range": 0, "num_eq": 4694343640852303060, "num_range": 5322629381777980909, "upper_bound": "0.021447950478047206"}, {"distinct_range": 0, "num_eq": 40000, "num_range": 1367417688374298407, "upper_bound": "0.17437649308145875"}, {"distinct_range": 1431927666916251100, "num_eq": 6535171847204362729, "num_range": 1431927666916251025, "upper_bound": "0.4280974080442354"}, {"distinct_range": 0, "num_eq": 9198871625414619442, "num_range": 80000000000, "upper_bound": "0.862760321280251"}], "histo_col_type": "FLOAT8", "name": "__auto__", "null_count": 92984994558, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 56083918278, "histo_col_type": "", "name": "__auto__", "null_count": 21154471638, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4600207680, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 100000000000}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 75475549932, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 100000000000}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2320252213474918839, "histo_col_type": "", "name": "__auto__", "null_count": 1518400686224483889, "row_count": 2977998389161674484}, {"avg_size": 0, "columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1424119036496537104, "histo_buckets": [{"distinct_range": 0, "num_eq": 5000000000, "num_range": 0, "upper_bound": "118.71.87.154/7"}, {"distinct_range": 0, "num_eq": 60000, "num_range": 3481669527947190747, "upper_bound": "53.239.198.72/15"}, {"distinct_range": 6211721081111102000, "num_eq": 7000000, "num_range": 6211721081111102074, "upper_bound": "175.123.134.59/17"}, {"distinct_range": 746215423047709600, "num_eq": 3742006750917077649, "num_range": 7604392329361036128, "upper_bound": "96.248.151.253/18"}, {"distinct_range": 80000000000, "num_eq": 20000, "num_range": 80000000000, "upper_bound": "139.229.167.8/21"}, {"distinct_range": 9544901.757017976, "num_eq": 9000, "num_range": 40000000, "upper_bound": "50.151.10.75/30"}, {"distinct_range": 8548885488952726000, "num_eq": 7000, "num_range": 8548885488952724995, "upper_bound": "a117:3768:10b0:cf99:a98d:39fc:87f1:3957/41"}, {"distinct_range": 0, "num_eq": 10000, "num_range": 8940752013228271300, "upper_bound": "fc54:9e8b:cad4:b50b:112b:87ae:ceb2:77bf/58"}, {"distinct_range": 60000000, "num_eq": 2175610659134253185, "num_range": 60000000, "upper_bound": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"}], "histo_col_type": "INET", "name": "__auto__", "null_count": 660022971158865233, "row_count": 2977998389161674484}, {"avg_size": 0, "columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1622460923205375198, "histo_buckets": [{"distinct_range": 0, "num_eq": 200000000, "num_range": 0, "upper_bound": "1977-04-22 12:24:40.000365+00:00"}, {"distinct_range": 0, "num_eq": 3000, "num_range": 0, "upper_bound": "1984-11-06 13:05:34.000159+00:00"}, {"distinct_range": 0, "num_eq": 100000000000, "num_range": 2765918669246668067, "upper_bound": "2000-08-01 20:12:10.000177+00:00"}, {"distinct_range": 20000, "num_eq": 400000000, "num_range": 20000, "upper_bound": "2002-04-07 01:58:18.000805+00:00"}, {"distinct_range": 0, "num_eq": 196957090277412163, "num_range": 60000000000, "upper_bound": "2007-07-23 19:56:09.000941+00:00"}, {"distinct_range": 2383618993727984000, "num_eq": 8176622265286242019, "num_range": 2383618993727984298, "upper_bound": "2008-05-19 15:41:39.000258+00:00"}, {"distinct_range": 0, "num_eq": 5904934200546072669, "num_range": 700000000, "upper_bound": "2032-08-06 04:44:05.000815+00:00"}, {"distinct_range": 0, "num_eq": 8811503724344523827, "num_range": 3104399982753464331, "upper_bound": "3000-01-01 00:00:00+00:00"}, {"distinct_range": 9140913322899541000, "num_eq": 600000, "num_range": 9140913322899541198, "upper_bound": "294276-12-31 23:59:59.999999+00:00"}], "histo_col_type": "TIMESTAMPTZ", "name": "__auto__", "null_count": 2496404543989527958, "row_count": 2977998389161674484}, {"avg_size": 0, "columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 215217474085511137, "histo_buckets": [{"distinct_range": 0, "num_eq": 4133383700111246287, "num_range": 0, "upper_bound": ""}, {"distinct_range": 284884.3412923074, "num_eq": 6000000000, "num_range": 500000, "upper_bound": "\\u0013O4"}, {"distinct_range": 4172744269360115700, "num_eq": 80000, "num_range": 7232483465374189833, "upper_bound": "X"}, {"distinct_range": 7559397755342167000, "num_eq": 80000000000, "num_range": 7559397755342166665, "upper_bound": "ri[JC-"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 1217843945020892346, "row_count": 2977998389161674484}, {"avg_size": 0, "columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 180635707411548749, "histo_col_type": "", "name": "__auto__", "null_count": 1546255217560478808, "row_count": 2977998389161674484}, {"avg_size": 0, "columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 184563492108415353, "histo_buckets": [{"distinct_range": 0, "num_eq": 2730676893015166208, "num_range": 0, "upper_bound": "1989-10-19"}], "histo_col_type": "DATE", "name": "__auto__", "null_count": 0, "row_count": 2977998389161674484}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('rs', 'bfnn', 's', 'wzlbg', 'cvjym');
        CREATE TYPE rand_typ_1 AS ENUM ('pnwa', 'ko', 'cvv');
        CREATE TYPE rand_typ_2 AS ENUM ('bres', 'vxfjey', 'na');
        CREATE TYPE rand_typ_3 AS ENUM ('wsxd', 'i', 'vmob', 'ert');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith804032091
--- FAIL: TestRandomSyntaxSQLSmith (300.89s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@rytaft
Copy link
Collaborator

rytaft commented Dec 30, 2021

Most recent failure is similar to #65038, but there's clearly still an issue. Opened a new one: #74332.

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ fdd672fed84323279f7070127f36cdbdc5c26b03:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: statement exec timeout

Query:

        SELECT
        	tab_107977.col4_5 AS col_239433,
        	1605484103:::OID AS col_239434,
        	75558.15479099610499:::DECIMAL AS col_239435,
        	tab_107977.col4_5 AS col_239436,
        	3804467898:::OID AS col_239437
        FROM
        	defaultdb.public.table1@table1_col1_4_col1_3_col1_1_idx AS tab_107974
        	JOIN defaultdb.public.table5@table5_col5_0_col5_2_col5_3_key AS tab_107975 ON
        			(tab_107974.col1_3) = (tab_107975.tableoid)
        	JOIN defaultdb.public.seed@seed__int8__float8__date_idx AS tab_107976
        		JOIN defaultdb.public.table4@[0] AS tab_107977
        			JOIN defaultdb.public.table2@[0] AS tab_107978
        				JOIN defaultdb.public.table2@table2_col2_2_col2_1_expr_col2_4_col2_3_key AS tab_107979
        					JOIN defaultdb.public.table3@table3_col3_1_key2 AS tab_107980 ON
        							(tab_107979.tableoid) = (tab_107980.tableoid)
        							AND (tab_107979.crdb_internal_mvcc_timestamp) = (tab_107980.crdb_internal_mvcc_timestamp)
        							AND (tab_107979.col2_3) = (tab_107980.tableoid) ON
        						(tab_107978.col2_3) = (tab_107980.tableoid) ON
        					(tab_107977.col4_4) = (tab_107979.col2_1)
        					AND (tab_107977.tableoid) = (tab_107979.col2_3)
        					AND (tab_107977.col4_5) = (tab_107979.col2_3)
        					AND (tab_107977.col4_7) = (tab_107980.tableoid)
        			JOIN defaultdb.public.table3 AS tab_107981
        				JOIN defaultdb.public.table3 AS tab_107982 ON (tab_107981.col3_1) = (tab_107982.col3_1) ON
        					(tab_107980.col3_1) = (tab_107981.col3_1) AND (tab_107980.col3_1) = (tab_107982.col3_1) ON
        				(tab_107976._int8) = (tab_107978.col2_1)
        				AND (tab_107976.tableoid) = (tab_107977.tableoid)
        				AND (tab_107976._int2) = (tab_107978.col2_1)
        				AND (tab_107976._float8) = (tab_107980.col3_1)
        				AND (tab_107976.crdb_internal_mvcc_timestamp) = (tab_107979.crdb_internal_mvcc_timestamp)
        				AND (tab_107976._int2) = (tab_107979.col2_1) ON
        			(tab_107974.crdb_internal_mvcc_timestamp) = (tab_107976._decimal)
        			AND (tab_107974.tableoid) = (tab_107977.col4_5)
        			AND (tab_107975.col5_0) = (tab_107976.tableoid)
        			AND (tab_107975.col5_2) = (tab_107976._string)
        WHERE
        	(tab_107976._bool AND tab_107976._bool)
        ORDER BY
        	tab_107975.col5_8 ASC
        LIMIT
        	38:::INT8;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 BOX2D, col1_1 NAME NOT NULL, col1_2 GEOMETRY NOT NULL, col1_3 REGNAMESPACE NOT NULL, col1_4 TIMESTAMP NULL, INVERTED INDEX (col1_3 ASC, lower(CAST(col1_2 AS STRING)) DESC, col1_1 ASC, col1_0 ASC, col1_2 ASC) WHERE (table1.col1_1 >= '':::STRING) AND (table1.col1_4 > '-2000-01-01 00:00:00':::TIMESTAMP), UNIQUE (col1_1), INDEX (col1_4 DESC, col1_3 ASC, col1_1));
        CREATE TABLE table2 (col2_0 GEOMETRY NOT NULL, col2_1 INT8 NOT NULL, col2_2 TIMESTAMP, col2_3 OID, col2_4 TIMETZ NOT NULL, col2_5 BIT(33) NOT NULL, UNIQUE (col2_3 DESC, lower(CAST(col2_3 AS STRING)), col2_2, lower(CAST(col2_0 AS STRING)), col2_5 ASC) STORING (col2_0, col2_4) WHERE ((table2.col2_2 != '294276-12-31 23:59:59.999999':::TIMESTAMP) OR (table2.col2_1 >= (-9223372036854775807):::INT8)) OR (table2.col2_4 < '24:00:00-15:59:00':::TIMETZ), INVERTED INDEX (col2_3, col2_0 ASC) WHERE table2.col2_1 <= (-1):::INT8, UNIQUE (col2_2 DESC, col2_1 ASC, lower(CAST(col2_0 AS STRING)), col2_4 DESC, col2_3) WHERE ((table2.col2_4 = '00:00:00+15:59:00':::TIMETZ) AND (table2.col2_2 != '-2000-01-01 00:00:00':::TIMESTAMP)) OR (table2.col2_1 <= 0:::INT8));
        CREATE TABLE table3 (col3_0 UUID, col3_1 FLOAT4 NOT NULL, PRIMARY KEY (col3_1 ASC), UNIQUE (col3_1) STORING (col3_0), UNIQUE (col3_1 DESC) WHERE table3.col3_1 = 0.0:::FLOAT8, INDEX (col3_1 DESC) STORING (col3_0) WHERE table3.col3_1 <= 1.401298464324817e-45:::FLOAT8, UNIQUE (col3_1 ASC), UNIQUE (lower(CAST(col3_0 AS STRING)) DESC) WHERE table3.col3_1 <= '+Inf':::FLOAT8, INDEX (col3_0 ASC), INDEX (col3_0 ASC, col3_1 DESC) WHERE table3.col3_1 >= '+Inf':::FLOAT8, UNIQUE (col3_0, col3_1 DESC), FAMILY (col3_1), FAMILY (col3_0));
        CREATE TABLE table4 (col4_0 REGNAMESPACE, col4_1 STRING NOT NULL, col4_2 VARCHAR NULL, col4_3 DATE, col4_4 INT8 NOT NULL, col4_5 REGCLASS NULL, col4_6 REGROLE NULL, col4_7 REGTYPE NOT NULL, col4_8 STRING NULL AS (lower(col4_2)) VIRTUAL, col4_9 STRING NOT NULL AS (lower(col4_1)) STORED, col4_10 STRING NULL AS (CASE WHEN col4_5 IS NULL THEN e'j\x11\x0f|':::STRING ELSE e'Pp9)J|\x1b~j':::STRING END) VIRTUAL, col4_11 STRING NULL AS (lower(col4_2)) VIRTUAL, col4_12 STRING AS (lower(CAST(col4_3 AS STRING))) VIRTUAL, PRIMARY KEY (col4_7 ASC), UNIQUE (col4_5 ASC, col4_1, col4_0 ASC, col4_4 ASC, col4_6, col4_12 DESC, col4_10, col4_9 ASC, col4_2, col4_3, col4_7 DESC), UNIQUE (col4_12 ASC, col4_0, col4_6, (CASE WHEN col4_6 IS NULL THEN e'\x1dZTc;M!':::STRING ELSE e'B)\x1d\x13U':::STRING END) ASC, col4_5, col4_7 DESC, col4_4, col4_9 ASC) STORING (col4_2) WHERE ((((((((table4.col4_8 > e'\'':::STRING) OR (table4.col4_10 < e'\'':::STRING)) AND (table4.col4_9 > '"':::STRING)) AND (table4.col4_2 = e'\U00002603':::STRING)) AND (table4.col4_4 != (-1):::INT8)) AND (table4.col4_3 > '-infinity':::DATE)) AND (table4.col4_1 <= e'\'':::STRING)) AND (table4.col4_11 < e'\'':::STRING)) OR (table4.col4_12 >= '"':::STRING), INDEX (col4_12 ASC, col4_2) WHERE ((((((table4.col4_4 > 1:::INT8) AND (table4.col4_9 >= 'X':::STRING)) OR (table4.col4_10 > 'X':::STRING)) AND (table4.col4_11 >= 'X':::STRING)) AND (table4.col4_12 < e'\'':::STRING)) OR (table4.col4_8 >= 'X':::STRING)) AND (table4.col4_2 != e'\x00':::STRING), INDEX (col4_2, col4_10 DESC, col4_9 DESC, col4_8, col4_12, col4_5, col4_0 ASC, col4_11 ASC, col4_1, lower(col4_2) ASC, col4_3, (col4_4 + (-3170187048826858787):::INT8), (CASE WHEN col4_5 IS NULL THEN e'\x0fVL"':::STRING ELSE e'<\x0f\x1b':::STRING END) ASC) STORING (col4_4, col4_6), UNIQUE ((CASE WHEN col4_7 IS NULL THEN e'%d8O\x15^7':::STRING ELSE e'o\r&MU^\x14':::STRING END), col4_3 ASC, (CASE WHEN col4_6 IS NULL THEN '.ZRg7RN+_':::STRING ELSE e'i\r\f\\$':::STRING END), col4_4 DESC) STORING (col4_9) WHERE ((((((((table4.col4_9 > '"':::STRING) AND (table4.col4_10 < e'\'':::STRING)) OR (table4.col4_4 = 9223372036854775807:::INT8)) OR (table4.col4_11 != '"':::STRING)) AND (table4.col4_12 > '':::STRING)) AND (table4.col4_1 < e'\'':::STRING)) OR (table4.col4_2 = 'X':::STRING)) OR (table4.col4_8 >= e'\'':::STRING)) OR (table4.col4_3 <= '4714-11-24 BC':::DATE));
        CREATE TABLE table5 (col5_0 REGTYPE NOT NULL, col5_1 TIMESTAMP, col5_2 VARCHAR NULL, col5_3 OID, col5_4 TIMESTAMPTZ NULL, col5_5 TIME, col5_6 BOX2D NOT NULL, col5_7 STRING AS (lower(CAST(col5_5 AS STRING))) VIRTUAL, col5_8 STRING NULL AS (CASE WHEN col5_4 IS NULL THEN e'\x00':::STRING ELSE e'\x12':::STRING END) VIRTUAL, INDEX (col5_6 ASC, col5_1 DESC, col5_7 DESC, col5_5 DESC), UNIQUE (col5_8, col5_1 DESC, col5_3, col5_2 ASC, col5_7, col5_4, col5_5 DESC), INDEX (col5_3, lower(CAST(col5_1 AS STRING)) DESC, col5_8 ASC, col5_2, col5_4, col5_0 ASC, col5_5 ASC, col5_7 ASC, col5_1) WHERE (((((table5.col5_7 <= '"':::STRING) OR (table5.col5_8 > e'\'':::STRING)) AND (table5.col5_5 = '24:00:00':::TIME)) OR (table5.col5_4 > '3000-01-01 00:00:00+00:00':::TIMESTAMPTZ)) OR (table5.col5_2 > '"':::STRING)) OR (table5.col5_1 = '0001-01-01 00:00:00':::TIMESTAMP), UNIQUE (col5_6 ASC, col5_4 ASC, col5_0 DESC, col5_1 DESC) WHERE (((((table5.col5_5 >= '00:00:00':::TIME) OR (table5.col5_8 = 'X':::STRING)) OR (table5.col5_4 >= '294276-12-31 23:59:59.999999+00:00':::TIMESTAMPTZ)) AND (table5.col5_1 < '-4713-11-24 00:00:00':::TIMESTAMP)) AND (table5.col5_2 < '"':::STRING)) AND (table5.col5_7 > e'\x00':::STRING), FAMILY (col5_0, col5_5, col5_6), FAMILY (col5_3), FAMILY (col5_2), FAMILY (col5_1, col5_4), UNIQUE (col5_0, col5_2, col5_3));
        ALTER TABLE table1 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2084328964201635092, "histo_buckets": [{"distinct_range": 0, "num_eq": 4968566834013354776, "num_range": 0, "upper_bound": "1980-09-13 12:28:55.000497"}, {"distinct_range": 6000000000, "num_eq": 2000000000, "num_range": 6000000000, "upper_bound": "2004-12-27 14:17:32.000857"}, {"distinct_range": 0, "num_eq": 4060793604414790434, "num_range": 200000000, "upper_bound": "2008-10-14 01:48:39.000322"}, {"distinct_range": 0, "num_eq": 7000, "num_range": 700000, "upper_bound": "2011-02-21 03:46:48.00068"}, {"distinct_range": 0, "num_eq": 3356653820229987859, "num_range": 700, "upper_bound": "2012-06-04 07:33:57.000303"}, {"distinct_range": 1000, "num_eq": 6964088268645110583, "num_range": 1000, "upper_bound": "2017-09-04 09:52:54.000428"}, {"distinct_range": 2439032694711946000, "num_eq": 1275876394574618125, "num_range": 5026961961287553309, "upper_bound": "2028-09-14 01:51:57.000453"}], "histo_col_type": "TIMESTAMP", "name": "__auto__", "null_count": 2221682584520682211, "row_count": 5673167287232439684}, {"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2651380238324328225, "histo_col_type": "", "name": "__auto__", "null_count": 2284310074352392807, "row_count": 5673167287232439684}, {"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1351331438750381490, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5673167287232439684}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1868115259362700109, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5673167287232439684}, {"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2307113990235904375, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5673167287232439684}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 127093496, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200000000}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 48038675, "histo_buckets": [{"distinct_range": 0, "num_eq": 400000, "num_range": 0, "upper_bound": "1971-06-05 12:42:51.000507"}, {"distinct_range": 3810961384.734457, "num_eq": 40000000, "num_range": 9000000000, "upper_bound": "1980-11-18 12:26:33.000114"}, {"distinct_range": 0, "num_eq": 364087980968258169, "num_range": 0, "upper_bound": "1993-08-18 05:21:32.000377"}, {"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "2007-05-14 18:35:23.000976"}], "histo_col_type": "TIMESTAMP", "name": "__auto__", "null_count": 136667484, "row_count": 200000000}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 147886829, "histo_buckets": [{"distinct_range": 0, "num_eq": 90000, "num_range": 0, "upper_bound": "637745430"}, {"distinct_range": 3000, "num_eq": 264270430254446290, "num_range": 3000, "upper_bound": "1396171008"}, {"distinct_range": 0, "num_eq": 20000000000, "num_range": 70000000, "upper_bound": "2243574905"}, {"distinct_range": 180946612380360900, "num_eq": 5000000, "num_range": 180946612380360912, "upper_bound": "3628550210"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 97782582, "row_count": 200000000}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 50954351, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200000000}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 61792840, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200000000}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 101258907, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200000000}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7, "histo_buckets": [{"distinct_range": 0, "num_eq": 6497374893205309952, "num_range": 0, "upper_bound": "4d1d827d-ee1a-4e10-9c0b-3c76e0624c63"}, {"distinct_range": 0, "num_eq": 1000000, "num_range": 2000000, "upper_bound": "50e782cf-410c-4428-ac8b-41cb5b8e0b2a"}, {"distinct_range": 1096378033332783000, "num_eq": 8462631759690034587, "num_range": 1096378033332783009, "upper_bound": "514a00e5-e488-457c-bb94-ccae5d7bd53c"}, {"distinct_range": 0, "num_eq": 8000, "num_range": 0, "upper_bound": "fbd37261-5077-4fb2-b4de-3e5e70e113b7"}], "histo_col_type": "UUID", "name": "__auto__", "null_count": 2, "row_count": 20}, {"avg_size": 0, "columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7, "histo_buckets": [{"distinct_range": 0, "num_eq": 6000, "num_range": 0, "upper_bound": "-1.0104255676269531"}, {"distinct_range": 270.62111769036505, "num_eq": 30000000000, "num_range": 600, "upper_bound": "-0.3692953884601593"}, {"distinct_range": 7270060336860886000, "num_eq": 1163422539940019451, "num_range": 7270060336860885532, "upper_bound": "0.09834223240613937"}, {"distinct_range": 8024186892449047000, "num_eq": 855476150584286030, "num_range": 8024186892449046663, "upper_bound": "0.2550393342971802"}, {"distinct_range": 1377900573964585200, "num_eq": 8000000, "num_range": 1377900573964585225, "upper_bound": "0.8720020651817322"}, {"distinct_range": 845131237324034800, "num_eq": 4531993522551731328, "num_range": 845131237324034848, "upper_bound": "1.08162260055542"}], "histo_col_type": "FLOAT4", "name": "__auto__", "null_count": 0, "row_count": 20}]':::JSONB;
        ALTER TABLE table4 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col4_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1644918009, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1377551600, "histo_col_type": "", "name": "__auto__", "null_count": 1094398751, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1856060671, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 585539521, "histo_buckets": [{"distinct_range": 0, "num_eq": 6321902528102770143, "num_range": 0, "upper_bound": "1646079598"}, {"distinct_range": 286.01595683307966, "num_eq": 8000, "num_range": 4000, "upper_bound": "2252630385"}, {"distinct_range": 4559932280039946000, "num_eq": 3906516385039698687, "num_range": 4610160656182875733, "upper_bound": "2286810402"}, {"distinct_range": 700000000, "num_eq": 1322525462252246534, "num_range": 700000000, "upper_bound": "3921136751"}], "histo_col_type": "REGCLASS", "name": "__auto__", "null_count": 1358000619, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1564442272, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 717176404, "histo_col_type": "", "name": "__auto__", "null_count": 1500525855, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 382986659, "histo_buckets": [{"distinct_range": 0, "num_eq": 7095153877631093832, "num_range": 0, "upper_bound": "\\u0011G"}, {"distinct_range": 2066733323713799000, "num_eq": 50, "num_range": 2066733323713798980, "upper_bound": "\U00002603"}], "histo_col_type": "VARCHAR", "name": "__auto__", "null_count": 1851874949, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 224922124, "histo_col_type": "", "name": "__auto__", "null_count": 1224102095, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1424652, "histo_buckets": [{"distinct_range": 0, "num_eq": 442935941502213319, "num_range": 0, "upper_bound": "144230879"}, {"distinct_range": 0, "num_eq": 3751651588880056643, "num_range": 4167894568042597922, "upper_bound": "467508007"}, {"distinct_range": 4183028.8397437194, "num_eq": 50000000, "num_range": 9000000, "upper_bound": "817109611"}, {"distinct_range": 20, "num_eq": 0, "num_range": 20, "upper_bound": "1509413232"}, {"distinct_range": 264.2110614962472, "num_eq": 400000000, "num_range": 1000, "upper_bound": "2054608840"}, {"distinct_range": 90000, "num_eq": 10, "num_range": 90000, "upper_bound": "2370333793"}, {"distinct_range": 0, "num_eq": 4931304102118167717, "num_range": 60000000, "upper_bound": "2440585541"}, {"distinct_range": 70000000, "num_eq": 0, "num_range": 70000000, "upper_bound": "2486054715"}, {"distinct_range": 1307916158332135200, "num_eq": 0, "num_range": 1307916158332135042, "upper_bound": "3345724238"}], "histo_col_type": "REGTYPE", "name": "__auto__", "null_count": 0, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 833031694, "histo_col_type": "", "name": "__auto__", "null_count": 872495526, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1527490867, "histo_col_type": "", "name": "__auto__", "null_count": 1845921573, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1823021122, "histo_col_type": "", "name": "__auto__", "null_count": 236217138, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col4_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 455509519, "histo_buckets": [{"distinct_range": 0, "num_eq": 3534161073735548302, "num_range": 0, "upper_bound": ""}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 1207673789, "row_count": 2000000000}]':::JSONB;
        ALTER TABLE table5 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col5_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 923569270466559806, "histo_col_type": "", "name": "__auto__", "null_count": 1061990468601797693, "row_count": 3500091148061701449}, {"avg_size": 0, "columns": ["col5_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2726230202949871049, "histo_col_type": "", "name": "__auto__", "null_count": 2907036747482510400, "row_count": 3500091148061701449}, {"avg_size": 0, "columns": ["col5_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1982048800814674231, "histo_col_type": "", "name": "__auto__", "null_count": 540069921677988943, "row_count": 3500091148061701449}, {"avg_size": 0, "columns": ["col5_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2045931955225394233, "histo_col_type": "", "name": "__auto__", "null_count": 1226413710617320639, "row_count": 3500091148061701449}, {"avg_size": 0, "columns": ["col5_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1742588766485587198, "histo_col_type": "", "name": "__auto__", "null_count": 1707418736073285378, "row_count": 3500091148061701449}, {"avg_size": 0, "columns": ["col5_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 48543429483838944, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3500091148061701449}, {"avg_size": 0, "columns": ["col5_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1736055748373141247, "histo_buckets": [{"distinct_range": 0, "num_eq": 2513279911148625090, "num_range": 0, "upper_bound": "\\""}, {"distinct_range": 4619742951217160000, "num_eq": 900, "num_range": 4619742951217160159, "upper_bound": "d@"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 1113100964637315390, "row_count": 3500091148061701449}, {"avg_size": 0, "columns": ["col5_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2687678471138745010, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3500091148061701449}, {"avg_size": 0, "columns": ["col5_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 321813502394541536, "histo_buckets": [{"distinct_range": 0, "num_eq": 4172601271255087613, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 32078924936473350, "num_eq": 4951073484962610403, "num_range": 229731991985090246, "upper_bound": "501949013"}, {"distinct_range": 1561491280156225000, "num_eq": 1747559247157512528, "num_range": 1561491280156225113, "upper_bound": "1658700126"}, {"distinct_range": 98003446.17933969, "num_eq": 5603042655649581330, "num_range": 700000000, "upper_bound": "1894998789"}, {"distinct_range": 0, "num_eq": 7000000, "num_range": 80000000, "upper_bound": "2082421162"}, {"distinct_range": 7120548322152358000, "num_eq": 3971944848427908791, "num_range": 7120548322152358222, "upper_bound": "2286212022"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 3215442228750038729, "row_count": 3500091148061701449}]':::JSONB;
        ALTER TABLE table4 ADD FOREIGN KEY (col4_0, col4_1, col4_5) REFERENCES table5 (col5_0, col5_2, col5_3);
        CREATE TYPE rand_typ_0 AS ENUM ('mqfgcv', 'epcqh', 'qn', 'u', 'xo', 'mydcdl');
        CREATE TYPE rand_typ_1 AS ENUM ('z', 'sibmgs');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith3911071676
--- FAIL: TestRandomSyntaxSQLSmith (562.16s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ c3d71ac887844bef174abb6dab2a4e1ce9270ab7:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: no volatility for cast regproc::regclass

Query:

        SELECT
        	tab_30.col1_1 AS col_60,
        	tab_28.col3_0 AS col_61,
        	tab_29.col3_5 AS col_62,
        	tab_28.col3_7 AS col_63,
        	tab_30.col1_3 AS col_64,
        	tab_28.col3_3 AS col_65,
        	tab_28.col3_9 AS col_66,
        	NULL AS col_67,
        	6499419127922206925:::DECIMAL AS col_68,
        	tab_30.tableoid AS col_69,
        	tab_28.col3_6 AS col_70,
        	'1983-08-18':::DATE AS col_71,
        	CASE WHEN false THEN tab_30.col1_7 ELSE tab_29.col3_2 END AS col_72,
        	tab_29.crdb_internal_mvcc_timestamp AS col_73,
        	tab_29.tableoid AS col_74,
        	3609167997:::OID AS col_75,
        	tab_30.col1_5 AS col_76,
        	tab_28.col3_6 AS col_77,
        	15268:::INT8 AS col_78
        FROM
        	defaultdb.public.table3@[0] AS tab_28
        	JOIN defaultdb.public.table3@[0] AS tab_29
        		JOIN defaultdb.public.table1@[0] AS tab_30 ON
        				(tab_29.col3_5) = (tab_30.col1_8) AND (tab_29.col3_6) = (tab_30.tableoid) ON
        			(tab_28.crdb_internal_mvcc_timestamp) = (tab_30.crdb_internal_mvcc_timestamp)
        WHERE
        	true;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 BYTES NULL, col1_1 GEOGRAPHY NOT NULL, col1_2 TIME NOT NULL, col1_3 TIMESTAMPTZ, col1_4 OID, col1_5 BIT(12) NOT NULL, col1_6 REGTYPE NOT NULL, col1_7 REGCLASS, col1_8 REGCLASS NOT NULL, col1_9 INT2 NULL, col1_10 TIMESTAMPTZ, col1_11 OID, INDEX (col1_0, col1_7 ASC, col1_6 ASC, col1_3 DESC, col1_4 ASC, col1_5 DESC, col1_8 ASC, col1_10, col1_9 ASC) STORING (col1_1, col1_2), FAMILY (col1_10), FAMILY (col1_5), FAMILY (col1_0), FAMILY (col1_1, col1_2), FAMILY (col1_9, col1_4), FAMILY (col1_7, col1_6, col1_11), FAMILY (col1_3, col1_8));
        CREATE TABLE table2 (col2_0 TIMETZ NOT NULL, col2_1 REGNAMESPACE, col2_2 TIMESTAMP NOT NULL, col2_3 BOX2D NOT NULL, col2_4 FLOAT8 NOT NULL, col2_5 BIT(24) NOT NULL, col2_6 INT4 NOT NULL, col2_7 INT8 NOT NULL, col2_8 REGPROC NOT NULL, col2_9 NAME NOT NULL, col2_10 FLOAT8 NOT NULL AS (col2_4 + 0.5099243893841376:::FLOAT8) STORED, PRIMARY KEY (col2_4, col2_10 DESC, col2_2, col2_9 DESC, col2_0 DESC, col2_6, col2_3 DESC, col2_8), INDEX (col2_6 DESC, col2_7 DESC, col2_2 ASC, col2_9 ASC, col2_1 DESC) STORING (col2_5) WHERE ((((((table2.col2_2 = '-2000-01-01 00:00:00':::TIMESTAMP) AND (table2.col2_6 > (-2147483648):::INT8)) AND (table2.col2_0 = '24:00:00-15:59:00':::TIMETZ)) OR (table2.col2_7 >= (-1):::INT8)) OR (table2.col2_10 != 5e-324:::FLOAT8)) AND (table2.col2_4 > 1.0:::FLOAT8)) AND (table2.col2_9 > e'\'':::STRING), INDEX (col2_7, col2_2 DESC, col2_6, col2_3 DESC) STORING (col2_1) WHERE ((((table2.col2_7 <= 1:::INT8) OR (table2.col2_2 >= '-2000-01-01 00:00:00':::TIMESTAMP)) OR (table2.col2_4 = '+Inf':::FLOAT8)) AND (table2.col2_9 > 'X':::STRING)) OR (table2.col2_0 > '24:00:00-15:59:00':::TIMETZ), FAMILY (col2_6, col2_4, col2_0, col2_2), FAMILY (col2_9, col2_10, col2_1, col2_8), FAMILY (col2_7, col2_3, col2_5));
        CREATE TABLE table3 (col3_0 REGNAMESPACE NULL, col3_1 INTERVAL NOT NULL, col3_2 REGPROC NOT NULL, col3_3 UUID NOT NULL, col3_4 BOX2D NOT NULL, col3_5 OID NOT NULL, col3_6 REGNAMESPACE, col3_7 DATE NOT NULL, col3_8 INTERVAL NOT NULL, col3_9 STRING NOT NULL AS (CASE WHEN col3_0 IS NULL THEN e'\x0eD':::STRING ELSE e'GralT\f':::STRING END) STORED, PRIMARY KEY (col3_9 DESC, col3_5, col3_1 DESC, col3_3, col3_7 DESC, col3_2 DESC, col3_8 DESC, col3_4 ASC), INDEX (col3_7 ASC, (CASE WHEN col3_0 IS NULL THEN e'.\x0bg5':::STRING ELSE e'\U00002603':::STRING END), col3_2 DESC, col3_5 DESC, col3_4 ASC) STORING (col3_0) WHERE (table3.col3_9 != '"':::STRING) OR (table3.col3_7 = '1970-01-01':::DATE), INDEX (col3_8, col3_4, col3_2, col3_0 ASC, col3_7 DESC, col3_6, lower(CAST(col3_3 AS STRING)) DESC, col3_5, col3_3 DESC), INDEX (col3_5, col3_7, col3_3, col3_8 DESC, lower(CAST(col3_4 AS STRING)) ASC), INDEX (col3_6, col3_5, col3_0 DESC, lower(CAST(col3_1 AS STRING)) ASC, col3_1 ASC, col3_3 ASC, col3_9, (CASE WHEN col3_2 IS NULL THEN '':::STRING ELSE e'\x10Y':::STRING END) ASC, col3_2, col3_8 DESC), UNIQUE (col3_7 DESC, col3_3 DESC, col3_6, col3_8 ASC, col3_1 ASC, col3_2 ASC, col3_4 DESC), UNIQUE (col3_6, col3_0 DESC, col3_3 DESC) WHERE (table3.col3_7 < '5874897-12-31':::DATE) AND (table3.col3_9 <= '':::STRING), INDEX (col3_9 DESC, col3_1, col3_4, col3_6 DESC, col3_7 DESC) WHERE (table3.col3_7 <= '5874897-12-31':::DATE) AND (table3.col3_9 > e'\U00002603':::STRING), INDEX (col3_7, col3_8 DESC, col3_9, col3_1, col3_5, col3_6, col3_0), INDEX (col3_5 DESC, col3_8 DESC, col3_0 ASC, col3_3 ASC, col3_6, col3_1 DESC, col3_2, col3_7));
        ALTER TABLE table1 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1941922597502753928, "histo_col_type": "", "name": "__auto__", "null_count": 2235045377831882118, "row_count": 3291896938079255509}, {"avg_size": 0, "columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2264995545603640172, "histo_col_type": "", "name": "__auto__", "null_count": 3227429385664720916, "row_count": 3291896938079255509}, {"avg_size": 0, "columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 436831634376409788, "histo_col_type": "", "name": "__auto__", "null_count": 1396216316018256177, "row_count": 3291896938079255509}, {"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2909499961562793213, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3291896938079255509}, {"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1135096449413716252, "histo_col_type": "", "name": "__auto__", "null_count": 1203168667487205657, "row_count": 3291896938079255509}, {"avg_size": 0, "columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1904894617604341262, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3291896938079255509}, {"avg_size": 0, "columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1933797072273269739, "histo_col_type": "", "name": "__auto__", "null_count": 939480053386197913, "row_count": 3291896938079255509}, {"avg_size": 0, "columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1814042212425764316, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3291896938079255509}, {"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3049177539437303940, "histo_buckets": [{"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "\\\\x58"}, {"distinct_range": 4194550114593773600, "num_eq": 1000, "num_range": 4194550114593773794, "upper_bound": "\\\\x670af0d82ae54e"}, {"distinct_range": 14.841943313349136, "num_eq": 1000, "num_range": 70, "upper_bound": "\\\\x9ca3"}, {"distinct_range": 90, "num_eq": 0, "num_range": 90, "upper_bound": "\\\\xcef30441894f18"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 1007753666038587065, "row_count": 3291896938079255509}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 627074742381876693, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3291896938079255509}, {"avg_size": 0, "columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3467603814618672, "histo_col_type": "", "name": "__auto__", "null_count": 173731894709546702, "row_count": 3291896938079255509}, {"avg_size": 0, "columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 174008509764297492, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3291896938079255509}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 56425552, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 60000000}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 44728712, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 60000000}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 42365509, "histo_buckets": [{"distinct_range": 0, "num_eq": 8000, "num_range": 0, "upper_bound": "-0.45684504858576136"}, {"distinct_range": 86396488715.07274, "num_eq": 6489145124934546643, "num_range": 90000000000, "upper_bound": "0.542647707558141"}, {"distinct_range": 71885.15894753142, "num_eq": 400000000, "num_range": 100000, "upper_bound": "0.9362712545507781"}, {"distinct_range": 0, "num_eq": 800000000, "num_range": 700000, "upper_bound": "1.0960486601246804"}, {"distinct_range": 781524419192692700, "num_eq": 10, "num_range": 5896567024447969378, "upper_bound": "1.3315223279544655"}, {"distinct_range": 0, "num_eq": 100, "num_range": 8193114969098784498, "upper_bound": "3.4028234663852886e+38"}], "histo_col_type": "FLOAT8", "name": "__auto__", "null_count": 0, "row_count": 60000000}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 27016478, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 60000000}, {"avg_size": 0, "columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 11406328, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 60000000}, {"avg_size": 0, "columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7751637, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 60000000}, {"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 17185605, "histo_col_type": "", "name": "__auto__", "null_count": 51822697, "row_count": 60000000}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 39699882, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 60000000}, {"avg_size": 0, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 22217309, "histo_buckets": [{"distinct_range": 0, "num_eq": 2000000000, "num_range": 0, "upper_bound": "-2062875186"}, {"distinct_range": 60, "num_eq": 609059392207656305, "num_range": 60, "upper_bound": "334816710"}, {"distinct_range": 2189784540.5865927, "num_eq": 1114603150972548364, "num_range": 70000000000, "upper_bound": "903965522"}, {"distinct_range": 28222753.083400767, "num_eq": 5569905575269320402, "num_range": 80000000, "upper_bound": "1153002898"}], "histo_col_type": "INT4", "name": "__auto__", "null_count": 0, "row_count": 60000000}, {"avg_size": 0, "columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 43401240, "histo_col_type": "INT8", "name": "__auto__", "null_count": 0, "row_count": 60000000}, {"avg_size": 0, "columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 19352476, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 60000000}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4999610377494235482, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6968277378995342739}, {"avg_size": 0, "columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 139988898642427194, "histo_buckets": [{"distinct_range": 0, "num_eq": 3020615584791740878, "num_range": 0, "upper_bound": "1979-12-09"}, {"distinct_range": 0, "num_eq": 5824914939550243433, "num_range": 874459563910757969, "upper_bound": "1981-12-08"}, {"distinct_range": 507.30925051519495, "num_eq": 700000, "num_range": 1000, "upper_bound": "1986-12-28"}, {"distinct_range": 0, "num_eq": 4899933005223462170, "num_range": 5663971589714092923, "upper_bound": "1990-09-22"}, {"distinct_range": 60000000, "num_eq": 4784214800444879201, "num_range": 60000000, "upper_bound": "1995-01-28"}], "histo_col_type": "DATE", "name": "__auto__", "null_count": 0, "row_count": 6968277378995342739}, {"avg_size": 0, "columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5921885316827657746, "histo_buckets": [{"distinct_range": 0, "num_eq": 80000000, "num_range": 0, "upper_bound": "+[.0"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 6968277378995342739}, {"avg_size": 0, "columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 743117383234132879, "histo_col_type": "", "name": "__auto__", "null_count": 4045278997890579430, "row_count": 6968277378995342739}, {"avg_size": 0, "columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5803649417782045915, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6968277378995342739}, {"avg_size": 0, "columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6091504246708007205, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6968277378995342739}, {"avg_size": 0, "columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4429406926643961354, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6968277378995342739}, {"avg_size": 0, "columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6627042182860632198, "histo_buckets": [{"distinct_range": 0, "num_eq": 200000000, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 0, "num_eq": 8856899525945939368, "num_range": 0, "upper_bound": "1022033752"}, {"distinct_range": 0, "num_eq": 3152497993216991004, "num_range": 1268028639222391714, "upper_bound": "2076251453"}, {"distinct_range": 0, "num_eq": 60000, "num_range": 8594399916604164794, "upper_bound": "3807504528"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 0, "row_count": 6968277378995342739}, {"avg_size": 0, "columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6860707998128456660, "histo_buckets": [{"distinct_range": 0, "num_eq": 60000000, "num_range": 0, "upper_bound": "1474192784"}, {"distinct_range": 814765072272719000, "num_eq": 81725159079025005, "num_range": 814765072272719002, "upper_bound": "2153945567"}, {"distinct_range": 0, "num_eq": 5000, "num_range": 4200364904541655285, "upper_bound": "2943195750"}, {"distinct_range": 9000000, "num_eq": 20000, "num_range": 9000000, "upper_bound": "2950179110"}, {"distinct_range": 3563030.5778812123, "num_eq": 9000000, "num_range": 10000000, "upper_bound": "3285463976"}], "histo_col_type": "REGNAMESPACE", "name": "__auto__", "null_count": 2908340996421121024, "row_count": 6968277378995342739}, {"avg_size": 0, "columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3817109959291610606, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6968277378995342739}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('r', 'pofxsd');
        CREATE TYPE rand_typ_1 AS ENUM ('bjxg', 'ix', 'gjhoc');
        CREATE TYPE rand_typ_2 AS ENUM ('ym');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith2293371874
--- FAIL: TestRandomSyntaxSQLSmith (300.85s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ d6b99e92bf55b6f4a0d79800d67924e04d0b2a6d:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: crdb_internal.replication_stream_progress(): job 7617205858991195215: log-job: UpdateDeadline() called on leaf txn

Query:

        SELECT
        	(-0.5796728134155273):::FLOAT8 AS col_14013,
        	tab_6130._float4 AS col_14014,
        	'3000-01-01 00:00:00+00:00':::TIMESTAMPTZ AS col_14015,
        	e'{"a=$<%/(8": {"b": [], "baz": [{}], "foo": null, "y kxa": {"a": [{}], "baz": {"foo": false}, "z5X": {"\\"Br*>J:rtG=": []}}}, "b": true}':::JSONB
        		AS col_14016,
        	tab_6130._decimal AS col_14017,
        	tab_6130._int4 AS col_14018,
        	crdb_internal.replication_stream_progress(7617205858991195215:::INT8::INT8, tab_6130._string::STRING)::BYTES
        		AS col_14019
        FROM
        	defaultdb.public.seed@seed__int8__float8__date_idx AS tab_6130
        LIMIT
        	75:::INT8;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 REGNAMESPACE, col1_1 DECIMAL NULL, col1_2 DATE NOT NULL, col1_3 INT2 NULL, col1_4 INT2 NOT NULL, col1_5 INT2 NOT NULL, col1_6 DECIMAL NULL AS (col1_1 + (-1.675205905886714368E+31):::DECIMAL) STORED, col1_7 DECIMAL NOT NULL AS (col1_1 + (-7.830762253152944725E+25):::DECIMAL) STORED, col1_8 STRING NOT NULL AS (CASE WHEN col1_0 IS NULL THEN e'Ab\x16"':::STRING ELSE '^':::STRING END) STORED, col1_9 INT2 NULL AS ((col1_5 + col1_4) + col1_3) STORED, PRIMARY KEY (col1_4 ASC, col1_5 ASC, col1_7 ASC, col1_2 ASC, col1_8), UNIQUE (col1_6 DESC, col1_0 DESC, col1_7 DESC, col1_1, (CASE WHEN col1_0 IS NULL THEN e'\U00002603':::STRING ELSE '@EaR9[5v':::STRING END) DESC, col1_3 ASC), UNIQUE (col1_9 ASC, col1_4, col1_6, col1_7 DESC, col1_8 DESC), INDEX (col1_2 DESC, col1_8 DESC, col1_4 ASC, col1_6, col1_3, col1_9, col1_5 DESC, col1_7 ASC, col1_0, col1_1 DESC) WHERE ((((table1.col1_9 <= 32767:::INT8) OR (table1.col1_7 < '-Infinity':::DECIMAL)) AND (table1.col1_8 > 'X':::STRING)) OR (table1.col1_6 > (-1.234E+401):::DECIMAL)) AND (table1.col1_2 < '4714-11-24 BC':::DATE), INDEX (col1_0 DESC, col1_9 ASC, col1_8 ASC, col1_2 ASC, col1_3, col1_6), UNIQUE (col1_0 DESC, col1_3, col1_9, col1_2 DESC, col1_6 DESC, col1_8 DESC) WHERE (table1.col1_6 < 0:::DECIMAL) AND (table1.col1_9 > 32767:::INT8), UNIQUE (col1_0));
        CREATE TABLE table2 (col2_0 REGNAMESPACE NOT NULL, col2_1 BYTES NOT NULL, col2_2 STRING NOT NULL, col2_3 OID, col2_4 INTERVAL NOT NULL, col2_5 INT2, col2_6 INET NOT NULL, col2_7 REGTYPE NULL, col2_8 OID NOT NULL, col2_9 INT2 NOT NULL AS (col2_5 + (-1):::INT8) VIRTUAL, col2_10 STRING NOT NULL AS (CASE WHEN col2_7 IS NULL THEN e'c&-\x1f\x19':::STRING ELSE NULL END) VIRTUAL, PRIMARY KEY (col2_8 ASC, col2_9 ASC, col2_1 DESC, col2_0 ASC, col2_10), UNIQUE (col2_9 ASC, lower(CAST(col2_4 AS STRING)), col2_4 ASC, col2_0 ASC, col2_10 ASC, col2_7) STORING (col2_6) WHERE ((((table2.col2_5 != 127:::INT8) OR (table2.col2_9 <= 32767:::INT8)) OR (table2.col2_1 != '\x00':::BYTES)) OR (table2.col2_2 < '"':::STRING)) OR (table2.col2_10 = '':::STRING), UNIQUE (col2_2 DESC, col2_1, col2_3 ASC), INDEX (col2_5 DESC) WHERE ((((table2.col2_2 = 'X':::STRING) OR (table2.col2_5 <= 0:::INT8)) AND (table2.col2_10 != e'\'':::STRING)) OR (table2.col2_1 != '\x58':::BYTES)) OR (table2.col2_9 < (-32768):::INT8), UNIQUE (col2_3 DESC, col2_1 DESC, col2_4 DESC, col2_9 ASC, lower(CAST(col2_6 AS STRING)) DESC, (CASE WHEN col2_0 IS NULL THEN 'h74vq~U':::STRING ELSE 'lkLY,z':::STRING END) ASC, col2_5 ASC, lower(CAST(col2_8 AS STRING)), col2_2 DESC, col2_8 ASC, col2_0 ASC), UNIQUE (col2_8 DESC, col2_2, col2_5 DESC) WHERE ((((table2.col2_2 > e'\'':::STRING) OR (table2.col2_1 <= '\x27':::BYTES)) OR (table2.col2_9 != (-1):::INT8)) AND (table2.col2_10 = 'X':::STRING)) OR (table2.col2_5 > 32767:::INT8), INDEX (col2_10) STORING (col2_3, col2_4, col2_7), UNIQUE (col2_0, col2_2 DESC, col2_4 ASC, col2_8 ASC) STORING (col2_3, col2_7), INDEX (col2_7 DESC, col2_6 DESC, col2_10 ASC, col2_8, col2_9, lower(CAST(col2_8 AS STRING)), col2_3 DESC), FAMILY (col2_3), FAMILY (col2_0, col2_1, col2_8), FAMILY (col2_2, col2_6), FAMILY (col2_4), FAMILY (col2_7), FAMILY (col2_5));
        CREATE TABLE table3 (col3_0 INET, col3_1 FLOAT4, col3_2 DECIMAL[], col3_3 "char", col3_4 GEOGRAPHY NOT NULL, col3_5 REGTYPE NOT NULL, col3_6 STRING NOT NULL AS (CASE WHEN col3_5 IS NULL THEN e'4 CO\x07K':::STRING ELSE e'Zz!\x1e1d@':::STRING END) VIRTUAL, col3_7 STRING AS (lower(col3_3)) VIRTUAL, col3_8 STRING NOT NULL AS (CASE WHEN col3_5 IS NULL THEN e'\U00002603':::STRING ELSE e'<Pt\\&':::STRING END) STORED, col3_9 STRING AS (lower(CAST(col3_0 AS STRING))) VIRTUAL, UNIQUE (col3_5));
        CREATE TABLE table4 (col4_0 CHAR NOT NULL, col4_1 GEOGRAPHY, PRIMARY KEY (col4_0), INVERTED INDEX (col4_1 ASC) WHERE table4.col4_0 > e'\U00002603':::STRING, INVERTED INDEX (col4_0 DESC, col4_1) WHERE table4.col4_0 = '':::STRING, INVERTED INDEX (col4_0 ASC, col4_1 ASC));
        ALTER TABLE table1 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7192932599178919405, "histo_col_type": "", "name": "__auto__", "null_count": 2967702944400206537, "row_count": 7330350101051529361}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3976577977515178257, "histo_buckets": [{"distinct_range": 0, "num_eq": 7743801178544087065, "num_range": 0, "upper_bound": "1972-01-05"}, {"distinct_range": 1591.012626272385, "num_eq": 3940030111264175688, "num_range": 9000, "upper_bound": "1973-10-21"}, {"distinct_range": 0, "num_eq": 50000000, "num_range": 300, "upper_bound": "1975-04-22"}, {"distinct_range": 3815292129.559016, "num_eq": 70000, "num_range": 5000000000, "upper_bound": "1979-01-23"}, {"distinct_range": 3815441911315665000, "num_eq": 8773726417108820097, "num_range": 5877333289155844929, "upper_bound": "1980-05-17"}, {"distinct_range": 0, "num_eq": 6056826836971271164, "num_range": 7376745371498851458, "upper_bound": "1981-09-26"}, {"distinct_range": 0, "num_eq": 2608779494531006248, "num_range": 700, "upper_bound": "1984-06-17"}, {"distinct_range": 8477702086303881000, "num_eq": 20, "num_range": 8477702086303881088, "upper_bound": "1993-07-21"}], "histo_col_type": "DATE", "name": "__auto__", "null_count": 0, "row_count": 7330350101051529361}, {"avg_size": 0, "columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6905899864957998633, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7330350101051529361}, {"avg_size": 0, "columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1504928389458191981, "histo_buckets": [{"distinct_range": 0, "num_eq": 30000000, "num_range": 0, "upper_bound": "-31243"}, {"distinct_range": 0, "num_eq": 600, "num_range": 100, "upper_bound": "-20334"}, {"distinct_range": 58318672.42253362, "num_eq": 600, "num_range": 400000000, "upper_bound": "-16175"}, {"distinct_range": 4100748333281024000, "num_eq": 6000000, "num_range": 4518616425419913356, "upper_bound": "-2342"}, {"distinct_range": 121786746308683800, "num_eq": 2745545402177088867, "num_range": 567923847824588611, "upper_bound": "3121"}, {"distinct_range": 6000, "num_eq": 20000000000, "num_range": 6000, "upper_bound": "16227"}, {"distinct_range": 0, "num_eq": 200000000, "num_range": 70000, "upper_bound": "31627"}], "histo_col_type": "INT2", "name": "__auto__", "null_count": 6455954782149578290, "row_count": 7330350101051529361}, {"avg_size": 0, "columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6687113532271128190, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7330350101051529361}, {"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1123390370657172765, "histo_buckets": [{"distinct_range": 0, "num_eq": 6000, "num_range": 0, "upper_bound": "3098556450"}, {"distinct_range": 3499217227782447000, "num_eq": 20000000000, "num_range": 4065736095939587158, "upper_bound": "3740700427"}], "histo_col_type": "REGNAMESPACE", "name": "__auto__", "null_count": 5516876668704531852, "row_count": 7330350101051529361}, {"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5046796789914238481, "histo_col_type": "", "name": "__auto__", "null_count": 695160672530218351, "row_count": 7330350101051529361}, {"avg_size": 0, "columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4509777634119203378, "histo_buckets": [{"distinct_range": 0, "num_eq": 10000000, "num_range": 0, "upper_bound": "-11168"}, {"distinct_range": 0, "num_eq": 10000000000, "num_range": 0, "upper_bound": "-4473"}, {"distinct_range": 137128030476537500, "num_eq": 70000000000, "num_range": 1348116830370150371, "upper_bound": "1"}, {"distinct_range": 217713047478290880, "num_eq": 200000, "num_range": 5867623345104742195, "upper_bound": "8031"}], "histo_col_type": "INT2", "name": "__auto__", "null_count": 0, "row_count": 7330350101051529361}, {"avg_size": 0, "columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3395160274004470813, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7330350101051529361}, {"avg_size": 0, "columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2362802658100834452, "histo_col_type": "", "name": "__auto__", "null_count": 1591744674649133100, "row_count": 7330350101051529361}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1286575336977763448, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7366500919965338787}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1581677913828133190, "histo_buckets": [{"distinct_range": 0, "num_eq": 3112792188171008252, "num_range": 0, "upper_bound": "-32514"}, {"distinct_range": 154744232.60871843, "num_eq": 8515887270279357505, "num_range": 700000000, "upper_bound": "-31921"}, {"distinct_range": 8000, "num_eq": 4242815007755142905, "num_range": 8000, "upper_bound": "-24578"}, {"distinct_range": 825974875350362200, "num_eq": 68595274135296935, "num_range": 1128532143865562955, "upper_bound": "-1"}, {"distinct_range": 2626.1588052835077, "num_eq": 0, "num_range": 5000, "upper_bound": "127"}, {"distinct_range": 0, "num_eq": 1000, "num_range": 797580612207935557, "upper_bound": "11741"}, {"distinct_range": 0, "num_eq": 1000000, "num_range": 400000, "upper_bound": "12075"}, {"distinct_range": 7702283203707822000, "num_eq": 80000000000, "num_range": 8460702225511589703, "upper_bound": "12349"}, {"distinct_range": 50000000000, "num_eq": 5672811502212032462, "num_range": 50000000000, "upper_bound": "24963"}], "histo_col_type": "INT2", "name": "__auto__", "null_count": 3626918943319675020, "row_count": 7366500919965338787}, {"avg_size": 0, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4080101835406008396, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7366500919965338787}, {"avg_size": 0, "columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3644857570800254159, "histo_col_type": "REGTYPE", "name": "__auto__", "null_count": 3683568135803032835, "row_count": 7366500919965338787}, {"avg_size": 0, "columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2322697860301919581, "histo_buckets": [{"distinct_range": 0, "num_eq": 500, "num_range": 0, "upper_bound": "449878292"}, {"distinct_range": 679295907804748400, "num_eq": 700, "num_range": 1069325441271783575, "upper_bound": "543768195"}, {"distinct_range": 0, "num_eq": 6042153660745643252, "num_range": 8455433187373924099, "upper_bound": "877032709"}, {"distinct_range": 0, "num_eq": 800, "num_range": 2134963765050823687, "upper_bound": "1145241388"}, {"distinct_range": 9693.982821743166, "num_eq": 1286858380637521737, "num_range": 30000, "upper_bound": "1599760450"}, {"distinct_range": 38.27891462271684, "num_eq": 0, "num_range": 40, "upper_bound": "2690463034"}, {"distinct_range": 0, "num_eq": 50, "num_range": 785507574470380252, "upper_bound": "4216851632"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 0, "row_count": 7366500919965338787}, {"avg_size": 0, "columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5838044891648252628, "histo_buckets": [{"distinct_range": 0, "num_eq": 4113361498450879912, "num_range": 0, "upper_bound": "-8208"}, {"distinct_range": 141.55836452617757, "num_eq": 7054299312148595126, "num_range": 200, "upper_bound": "28667"}], "histo_col_type": "INT2", "name": "__auto__", "null_count": 0, "row_count": 7366500919965338787}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 759906385800541588, "histo_col_type": "REGNAMESPACE", "name": "__auto__", "null_count": 0, "row_count": 7366500919965338787}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6525875229168768756, "histo_buckets": [{"distinct_range": 0, "num_eq": 1629924933033946135, "num_range": 0, "upper_bound": "\\u000e"}, {"distinct_range": 750010151.0750723, "num_eq": 10000000, "num_range": 900000000, "upper_bound": "9\\r\\u000b\\u0007"}, {"distinct_range": 0, "num_eq": 0, "num_range": 200, "upper_bound": "Ra``f\\u0017}q\\u0015."}, {"distinct_range": 1530663144856085500, "num_eq": 3000000, "num_range": 2595282864205103064, "upper_bound": "|\\nF|)\\u000f!\\u0001"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 7366500919965338787}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2986328601702580562, "histo_buckets": [{"distinct_range": 0, "num_eq": 7586301323974461737, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 0, "num_eq": 749348241260098469, "num_range": 3714158208601043181, "upper_bound": "846137655"}, {"distinct_range": 6679447679239055000, "num_eq": 1358573620200490661, "num_range": 6679447679239055203, "upper_bound": "2541933186"}, {"distinct_range": 278.6587373116796, "num_eq": 500, "num_range": 700, "upper_bound": "4153656890"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 951448474023484536, "row_count": 7366500919965338787}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3606235356639831285, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7366500919965338787}, {"avg_size": 0, "columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4354390870662088753, "histo_buckets": [{"distinct_range": 0, "num_eq": 3000000000, "num_range": 0, "upper_bound": "@@\\u000b\\u0006"}, {"distinct_range": 0, "num_eq": 4204116694792823866, "num_range": 7814064410232360600, "upper_bound": "T\\u001a#8O\\u0002"}, {"distinct_range": 38704415.68403172, "num_eq": 600000, "num_range": 100000000, "upper_bound": "eMu/\\u0006R-"}, {"distinct_range": 0, "num_eq": 300000, "num_range": 70000, "upper_bound": "qD6"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 7366500919965338787}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1839069564143190649, "histo_col_type": "", "name": "__auto__", "null_count": 1487692723085302342, "row_count": 1859995838078636489}, {"avg_size": 0, "columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1172838594336868220, "histo_col_type": "", "name": "__auto__", "null_count": 286240682857757337, "row_count": 1859995838078636489}, {"avg_size": 0, "columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 171519617267249130, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1859995838078636489}, {"avg_size": 0, "columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 512294945321403117, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1859995838078636489}, {"avg_size": 0, "columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 497937582757281348, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1859995838078636489}, {"avg_size": 0, "columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 770934428933892064, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1859995838078636489}, {"avg_size": 0, "columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1503590969654118164, "histo_col_type": "", "name": "__auto__", "null_count": 1070260064622381651, "row_count": 1859995838078636489}, {"avg_size": 0, "columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1526493053037452230, "histo_col_type": "", "name": "__auto__", "null_count": 82824758126840828, "row_count": 1859995838078636489}, {"avg_size": 0, "columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 230992544097499054, "histo_col_type": "", "name": "__auto__", "null_count": 157289963269244157, "row_count": 1859995838078636489}, {"avg_size": 0, "columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 684510454332264988, "histo_col_type": "", "name": "__auto__", "null_count": 1795704996718603778, "row_count": 1859995838078636489}]':::JSONB;
        ALTER TABLE table4 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col4_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3728690385542825885, "histo_buckets": [{"distinct_range": 0, "num_eq": 968058686656817229, "num_range": 0, "upper_bound": "\\u0010"}, {"distinct_range": 4845745654947976000, "num_eq": 600000000, "num_range": 4845745654947975924, "upper_bound": "\\u0017"}, {"distinct_range": 0, "num_eq": 20000000000, "num_range": 10000, "upper_bound": "\\""}, {"distinct_range": 0, "num_eq": 6000000, "num_range": 100000000, "upper_bound": "("}, {"distinct_range": 0, "num_eq": 8516515507768788038, "num_range": 9000000, "upper_bound": "U"}, {"distinct_range": 100, "num_eq": 7000000000, "num_range": 100, "upper_bound": "X"}, {"distinct_range": 0, "num_eq": 5031210498145715871, "num_range": 4000000, "upper_bound": "Z"}, {"distinct_range": 1111234570684388000, "num_eq": 1563031523474339358, "num_range": 3040384308935787461, "upper_bound": "}"}], "histo_col_type": "CHAR", "name": "__auto__", "null_count": 0, "row_count": 8889918769203956149}, {"avg_size": 0, "columns": ["col4_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3577968234329139044, "histo_buckets": [{"distinct_range": 0, "num_eq": 70000, "num_range": 0, "upper_bound": "\\\\x42fd0b0000000000000000c00921fb54442d18bfe8f822268a6965400921fb54442d183ff81349bbe64094"}, {"distinct_range": 6218801283447428000, "num_eq": 8406330388258888576, "num_range": 6218801283447428561, "upper_bound": "\\\\x42fd100000000000000000c009061013cc2a0fbff5b0562a46d43f4008c2bf3c5a92743ff6835f95d14494"}, {"distinct_range": 0, "num_eq": 0, "num_range": 200, "upper_bound": "\\\\x42fd100000000000000000c00921fb54442d18bff8b68567ec56f2400921fb54442d183ff8a092d6f49eb0"}, {"distinct_range": 0, "num_eq": 2614811764194195331, "num_range": 1000000, "upper_bound": "\\\\x42fd100000000000000000c00921fb54442d18bff8c85b6c432c2a400921fb54442d183ff91fac976e05b8"}, {"distinct_range": 0, "num_eq": 60, "num_range": 5503687173717916410, "upper_bound": "\\\\x42fd100000000000000000c00921fb54442d18bff908a927b839a9400921fb54442d183ff7dbde8a7fa279"}, {"distinct_range": 0, "num_eq": 300000, "num_range": 1240265966367590026, "upper_bound": "\\\\x42fd100000000000000000c00921fb54442d18bff913e5b7596987400921fb54442d183fdb2a7c5c3242f0"}, {"distinct_range": 0, "num_eq": 60, "num_range": 0, "upper_bound": "\\\\x42fd300000000000000000c009061013cc2a0fbff5b0562a46d43f4008c2bf3c5a92743ff6835f95d14494"}, {"distinct_range": 1520054189528920600, "num_eq": 70000000, "num_range": 1520054189528920473, "upper_bound": "\\\\x42fd300000000000000000c00921fb54442d18bff8b68567ec56f2400921fb54442d183ff8a092d6f49eb0"}, {"distinct_range": 70000, "num_eq": 9208934158754036173, "num_range": 70000, "upper_bound": "\\\\x42fd300000000000000000c00921fb54442d18bff8c85b6c432c2a400921fb54442d183ff91fac976e05b8"}, {"distinct_range": 0, "num_eq": 98532980594311994, "num_range": 5483087776518553252, "upper_bound": "\\\\x42fd300000000000000000c00921fb54442d18bff908a927b839a9400921fb54442d183ff7dbde8a7fa279"}, {"distinct_range": 3029723761854147600, "num_eq": 300, "num_range": 3029723761854147372, "upper_bound": "\\\\x42fd300000000000000000c00921fb54442d18bff913e5b7596987400921fb54442d183fdb2a7c5c3242f0"}, {"distinct_range": 0, "num_eq": 432811839640532435, "num_range": 0, "upper_bound": "\\\\x42fd350000000000000000c00921fb54442d18bfe8f822268a6965400921fb54442d183ff81349bbe64094"}, {"distinct_range": 0, "num_eq": 80000000, "num_range": 100000, "upper_bound": "\\\\x42fd430000000000000000bff8558b2ff188dcbff77782acae5d4b3ff619c62bb0e2bb3ff80e4bb7f24b04"}, {"distinct_range": 0, "num_eq": 300000, "num_range": 6000000000, "upper_bound": "\\\\x42fd44c000000000000000bff8558b2ff188dcbff77782acae5d4b3ff619c62bb0e2bb3ff80e4bb7f24b04"}, {"distinct_range": 0, "num_eq": 4000000, "num_range": 2153723050753880327, "upper_bound": "\\\\x42fd454000000000000000bff8558b2ff188dcbff77782acae5d4b3ff619c62bb0e2bb3ff80e4bb7f24b04"}, {"distinct_range": 3973.784764465778, "num_eq": 300000000, "num_range": 8000, "upper_bound": "\\\\x42fd4ff000000000000000bff8558b2ff188dcbff77782acae5d4b3ff619c62bb0e2bb3ff80e4bb7f24b04"}, {"distinct_range": 0, "num_eq": 4000000, "num_range": 7633593454188369503, "upper_bound": "\\\\x42fd500000000000000000c009061013cc2a0fbff5b0562a46d43f4008c2bf3c5a92743ff6835f95d14494"}, {"distinct_range": 0, "num_eq": 8961969656918088813, "num_range": 0, "upper_bound": "\\\\x42fd500000000000000000c00921fb54442d18bfe8f822268a6965400921fb54442d183ff81349bbe64094"}, {"distinct_range": 2609838.5553924534, "num_eq": 7902708787155290269, "num_range": 5000000, "upper_bound": "\\\\x42fd500000000000000000c00921fb54442d18bff8b68567ec56f2400921fb54442d183ff8a092d6f49eb0"}, {"distinct_range": 1000, "num_eq": 40000000, "num_range": 1000, "upper_bound": "\\\\x42fd500000000000000000c00921fb54442d18bff8c85b6c432c2a400921fb54442d183ff91fac976e05b8"}, {"distinct_range": 200000, "num_eq": 1263081177604606351, "num_range": 200000, "upper_bound": "\\\\x42fd500000000000000000c00921fb54442d18bff908a927b839a9400921fb54442d183ff7dbde8a7fa279"}, {"distinct_range": 0, "num_eq": 8186560371886957791, "num_range": 10000, "upper_bound": "\\\\x42fd500000000000000000c00921fb54442d18bff913e5b7596987400921fb54442d183fdb2a7c5c3242f0"}, {"distinct_range": 0, "num_eq": 1000000000, "num_range": 90000000, "upper_bound": "\\\\x42fd53653d735469cbdd003ffb0124816702f1bff640382ef2dce0c0001cf14aaef9cb3ff0533c1c7a4668"}, {"distinct_range": 1746422478647877000, "num_eq": 100000000000, "num_range": 1746422478647877180, "upper_bound": "\\\\x42fd5c6a9647f00a051d003ffb0124816702f1bff640382ef2dce0c0001cf14aaef9cb3ff0533c1c7a4668"}, {"distinct_range": 0, "num_eq": 2832454302539240017, "num_range": 7163669799510566420, "upper_bound": "\\\\x42fd700000000000000000c009061013cc2a0fbff5b0562a46d43f4008c2bf3c5a92743ff6835f95d14494"}, {"distinct_range": 0, "num_eq": 4000000000, "num_range": 2098173087843102826, "upper_bound": "\\\\x42fd700000000000000000c00921fb54442d18bfe8f822268a6965400921fb54442d183ff81349bbe64094"}, {"distinct_range": 0, "num_eq": 2737293737997008829, "num_range": 3116826410821570448, "upper_bound": "\\\\x42fd700000000000000000c00921fb54442d18bff8b68567ec56f2400921fb54442d183ff8a092d6f49eb0"}, {"distinct_range": 0, "num_eq": 80000, "num_range": 0, "upper_bound": "\\\\x42fd700000000000000000c00921fb54442d18bff8c85b6c432c2a400921fb54442d183ff91fac976e05b8"}, {"distinct_range": 1786694.8485677915, "num_eq": 50000000, "num_range": 2000000, "upper_bound": "\\\\x42fd700000000000000000c00921fb54442d18bff908a927b839a9400921fb54442d183ff7dbde8a7fa279"}, {"distinct_range": 8696232353234118000, "num_eq": 1000, "num_range": 8696232353234117408, "upper_bound": "\\\\x42fd700000000000000000c00921fb54442d18bff913e5b7596987400921fb54442d183fdb2a7c5c3242f0"}, {"distinct_range": 0, "num_eq": 90000, "num_range": 70000000, "upper_bound": "\\\\x42fd722c81075de54831003ffb0124816702f1bff640382ef2dce0c0001cf14aaef9cb3ff0533c1c7a4668"}, {"distinct_range": 0, "num_eq": 30000000000, "num_range": 100000000000, "upper_bound": "\\\\x42fd772496d9b0192521003ffb0124816702f1bff640382ef2dce0c0001cf14aaef9cb3ff0533c1c7a4668"}, {"distinct_range": 500, "num_eq": 8832862022940970492, "num_range": 500, "upper_bound": "\\\\x42fd7c8480161956b31f003ffb0124816702f1bff640382ef2dce0c0001cf14aaef9cb3ff0533c1c7a4668"}, {"distinct_range": 0, "num_eq": 4554467923771757435, "num_range": 1358602118911056048, "upper_bound": "\\\\x42fd840000000000000000c00921fb54442d18bff8b68567ec56f2400921fb54442d183ff8a092d6f49eb0"}, {"distinct_range": 5000, "num_eq": 7831928867584977816, "num_range": 5000, "upper_bound": "\\\\x42fd900000000000000000c009061013cc2a0fbff5b0562a46d43f4008c2bf3c5a92743ff6835f95d14494"}, {"distinct_range": 918811.2559796749, "num_eq": 9000000, "num_range": 1000000, "upper_bound": "\\\\x42fd900000000000000000c00921fb54442d18bfe8f822268a6965400921fb54442d183ff81349bbe64094"}, {"distinct_range": 165705084155577300, "num_eq": 600, "num_range": 1907847823871550215, "upper_bound": "\\\\x42fd900000000000000000c00921fb54442d18bff8c85b6c432c2a400921fb54442d183ff91fac976e05b8"}, {"distinct_range": 0, "num_eq": 5560042883790079893, "num_range": 0, "upper_bound": "\\\\x42fd900000000000000000c00921fb54442d18bff908a927b839a9400921fb54442d183ff7dbde8a7fa279"}, {"distinct_range": 525223188410959360, "num_eq": 1394618532277199151, "num_range": 525223188410959362, "upper_bound": "\\\\x42fd900000000000000000c00921fb54442d18bff913e5b7596987400921fb54442d183fdb2a7c5c3242f0"}, {"distinct_range": 415997203635142850, "num_eq": 6181268242878409397, "num_range": 5408658139419419551, "upper_bound": "\\\\x42fd917000000000000000bff8558b2ff188dcbff77782acae5d4b3ff619c62bb0e2bb3ff80e4bb7f24b04"}, {"distinct_range": 2033781404277063000, "num_eq": 6959270631455124235, "num_range": 5312745484317935707, "upper_bound": "\\\\x42fd93c000000000000000bff8558b2ff188dcbff77782acae5d4b3ff619c62bb0e2bb3ff80e4bb7f24b04"}, {"distinct_range": 0, "num_eq": 3411205129647178786, "num_range": 4637838544014807429, "upper_bound": "\\\\x42fd950000000000000000bff8558b2ff188dcbff77782acae5d4b3ff619c62bb0e2bb3ff80e4bb7f24b04"}, {"distinct_range": 285933632.5933399, "num_eq": 600000000, "num_range": 700000000, "upper_bound": "\\\\x42fda40000000000000000c00921fb54442d18bfe8f822268a6965400921fb54442d183ff81349bbe64094"}, {"distinct_range": 749704545731765500, "num_eq": 0, "num_range": 837267537091092443, "upper_bound": "\\\\x42fda9469ebd0caa9953003ffb0124816702f1bff640382ef2dce0c0001cf14aaef9cb3ff0533c1c7a4668"}, {"distinct_range": 9000000000, "num_eq": 400, "num_range": 9000000000, "upper_bound": "\\\\x42fda9b0b17e4c32d9bb003ffb0124816702f1bff640382ef2dce0c0001cf14aaef9cb3ff0533c1c7a4668"}, {"distinct_range": 0, "num_eq": 100000000, "num_range": 30000, "upper_bound": "\\\\x42fdad1338d9f36a1adb003ffb0124816702f1bff640382ef2dce0c0001cf14aaef9cb3ff0533c1c7a4668"}, {"distinct_range": 0, "num_eq": 509389582184719490, "num_range": 4052706479425310204, "upper_bound": "\\\\x42fdaf81eb2142afd00b003ffb0124816702f1bff640382ef2dce0c0001cf14aaef9cb3ff0533c1c7a4668"}, {"distinct_range": 0, "num_eq": 158411731383374285, "num_range": 900000, "upper_bound": "\\\\x42fdb00000000000000000c009061013cc2a0fbff5b0562a46d43f4008c2bf3c5a92743ff6835f95d14494"}, {"distinct_range": 1710650036136071000, "num_eq": 100000, "num_range": 2038942166005175145, "upper_bound": "\\\\x42fdb00000000000000000c00921fb54442d18bff8b68567ec56f2400921fb54442d183ff8a092d6f49eb0"}, {"distinct_range": 0, "num_eq": 1000000000, "num_range": 300, "upper_bound": "\\\\x42fdb00000000000000000c00921fb54442d18bff8c85b6c432c2a400921fb54442d183ff91fac976e05b8"}, {"distinct_range": 0, "num_eq": 3633301933929302677, "num_range": 40000, "upper_bound": "\\\\x42fdb00000000000000000c00921fb54442d18bff908a927b839a9400921fb54442d183ff7dbde8a7fa279"}, {"distinct_range": 0, "num_eq": 100000, "num_range": 8000000, "upper_bound": "\\\\x42fdb00000000000000000c00921fb54442d18bff913e5b7596987400921fb54442d183fdb2a7c5c3242f0"}, {"distinct_range": 1830346479452373000, "num_eq": 100, "num_range": 2571222894142591968, "upper_bound": "\\\\x42fdbc0000000000000000bff8558b2ff188dcbff77782acae5d4b3ff619c62bb0e2bb3ff80e4bb7f24b04"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 1699341097986108400, "row_count": 8889918769203956149}]':::JSONB;
        ALTER TABLE table2 ADD FOREIGN KEY (col2_3) REFERENCES table1 (col1_0);
        ALTER TABLE table1 ADD FOREIGN KEY (col1_0) REFERENCES table3 (col3_5);
        CREATE TYPE rand_typ_0 AS ENUM ('ovivbf');
        CREATE TYPE rand_typ_1 AS ENUM ('xch', 'ccpeu', 'zycgyh', 'fkpl', 'hcos', 'wsb');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith2392174281
--- FAIL: TestRandomSyntaxSQLSmith (301.19s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 78419450178335b31f542bd1b14fefdf4ecee0e8:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: no volatility for cast regrole::regnamespace

Query:

        WITH
        	with_5566 (col_31608)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(NULL),
        						(COALESCE(NULL, ARRAY[921:::INT8])),
        						(ARRAY[1:::INT8]),
        						(NULL),
        						(ARRAY[(-21258):::INT8,(-10288):::INT8])
        				)
        					AS tab_13474 (col_31608)
        		),
        	with_5567 (col_31609)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						('ad00c201-db92-44ce-82de-aa349b3f52a3':::UUID),
        						('48436964-be71-4ab7-911b-4beae8e10cc1':::UUID),
        						('c20ca201-8e27-43c2-b791-2ff8cdf132ff':::UUID),
        						('c6db1851-aa96-4e4d-8e76-151aedc945d4':::UUID)
        				)
        					AS tab_13475 (col_31609)
        		)
        SELECT
        	tab_13476.col1_0 AS col_31610,
        	tab_13476.tableoid AS col_31611,
        	356508820106.757295:::DECIMAL AS col_31612,
        	COALESCE(tab_13476.col1_1, tab_13476.col1_2) AS col_31613,
        	'23:49:09.276919+03:00:00':::TIMETZ AS col_31614,
        	756693828:::OID AS col_31615,
        	tab_13476.col1_0 AS col_31616
        FROM
        	defaultdb.public.table1@[0] AS tab_13476
        ORDER BY
        	tab_13476.col1_1 ASC
        LIMIT
        	8:::INT8;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 STRING, col1_1 REGNAMESPACE, col1_2 REGROLE NOT NULL, col1_3 TIMETZ, col1_4 STRING AS (lower(col1_0)) STORED, UNIQUE (col1_3, (CASE WHEN col1_1 IS NULL THEN e'Bwi0\x10':::STRING ELSE e'\x19v\x03':::STRING END) DESC, col1_4 DESC, col1_2 ASC, col1_1 ASC) STORING (col1_0) WHERE ((table1.col1_4 > e'\U00002603':::STRING) OR (table1.col1_3 < '24:00:00-15:59:00':::TIMETZ)) OR (table1.col1_0 >= e'\U00002603':::STRING));
        CREATE TABLE table2 (col2_0 REGTYPE NULL, col2_1 BIT(14) NULL, col2_2 INTERVAL[], col2_3 BOX2D NOT NULL, col2_4 VARCHAR NULL, col2_5 INT4 NOT NULL, col2_6 STRING AS (CASE WHEN col2_2 IS NULL THEN NULL ELSE e'4\x1d':::STRING END) STORED, col2_7 STRING AS (CASE WHEN col2_2 IS NULL THEN e'\x18:K':::STRING ELSE e'\x00':::STRING END) STORED, col2_8 STRING NULL AS (CASE WHEN col2_0 IS NULL THEN '':::STRING ELSE NULL END) VIRTUAL, col2_9 STRING NULL AS (CASE WHEN col2_0 IS NULL THEN e'\t)w"#:f':::STRING ELSE 'p@':::STRING END) STORED, col2_10 STRING NULL AS (CASE WHEN col2_0 IS NULL THEN e'\x17\b':::STRING ELSE e'\n,Zl\x1eY{bD':::STRING END) STORED, INDEX (col2_4, col2_6 ASC, col2_7 ASC, col2_8 ASC), INVERTED INDEX (col2_0 DESC, col2_10, col2_9, col2_3 ASC, col2_4 DESC, col2_1, col2_7 DESC, col2_8 ASC, col2_6 ASC, col2_5 ASC, col2_2 DESC) WHERE ((table2.col2_8 <= e'\U00002603':::STRING) AND (table2.col2_4 >= '"':::STRING)) OR (table2.col2_6 > e'\'':::STRING), INDEX ((CASE WHEN col2_0 IS NULL THEN '':::STRING ELSE 'gUdM["/I':::STRING END), lower(CAST(col2_3 AS STRING)) DESC, col2_0) STORING (col2_4, col2_5, col2_6, col2_7));
        ALTER TABLE table1 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col1_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": ["col1_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": 1560647834218878066, "num_range": 0, "upper_bound": "03:03:00.796245-01:20:00"}, {"distinct_range": 9000, "num_eq": 90000, "num_range": 9000, "upper_bound": "18:40:45.026022+02:54:00"}, {"distinct_range": 7000000000, "num_eq": 900, "num_range": 7000000000, "upper_bound": "11:37:35.88384-11:59:00"}, {"distinct_range": 1000000, "num_eq": 7623082505453790520, "num_range": 1000000, "upper_bound": "23:25:04.495442-13:03:00"}], "histo_col_type": "TIMETZ", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["col1_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}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2581918687345781855, "histo_col_type": "", "name": "__auto__", "null_count": 825664674051381400, "row_count": 3265850075704181383}, {"avg_size": 0, "columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1672170728737568825, "histo_col_type": "", "name": "__auto__", "null_count": 1708903396195706742, "row_count": 3265850075704181383}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2363962578614792218, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3265850075704181383}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1362909849007102191, "histo_buckets": [{"distinct_range": 0, "num_eq": 90000, "num_range": 0, "upper_bound": "n?W:Ke%"}], "histo_col_type": "VARCHAR", "name": "__auto__", "null_count": 26657085744322062, "row_count": 3265850075704181383}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1605885294332541044, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3265850075704181383}, {"avg_size": 0, "columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 974575425525464188, "histo_col_type": "", "name": "__auto__", "null_count": 3204100907719854663, "row_count": 3265850075704181383}, {"avg_size": 0, "columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2020442222536220896, "histo_col_type": "", "name": "__auto__", "null_count": 1134977854718336502, "row_count": 3265850075704181383}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2851071111717424685, "histo_buckets": [{"distinct_range": 0, "num_eq": 801201812757961523, "num_range": 0, "upper_bound": "36151166"}, {"distinct_range": 42031.320023018525, "num_eq": 8514562019432519303, "num_range": 60000, "upper_bound": "2549022906"}], "histo_col_type": "REGTYPE", "name": "__auto__", "null_count": 1330489658539152490, "row_count": 3265850075704181383}, {"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2828432612225001412, "histo_col_type": "", "name": "__auto__", "null_count": 215596010563206115, "row_count": 3265850075704181383}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 439053936116924615, "histo_col_type": "", "name": "__auto__", "null_count": 3142273536780663308, "row_count": 3265850075704181383}, {"avg_size": 0, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2599937843730467277, "histo_col_type": "", "name": "__auto__", "null_count": 2744429359913696168, "row_count": 3265850075704181383}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('ogsv', 'lsai', 'tzt', 'zctsto', 'ezvdt');
        CREATE TYPE rand_typ_1 AS ENUM ('h', 'lny', 'ywqg', 'xrcgki', 'lhiwh', 'x');
        CREATE TYPE rand_typ_2 AS ENUM ('vceqvb', 'tsdeqv', 'xj', 'xyhei', 'ioaoq', 'cow');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith761014168
--- FAIL: TestRandomSyntaxSQLSmith (329.61s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 5ad21e3896ee809e9c3ebc28bb22166f1275acca:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: crdb_internal.replication_stream_progress(): job 1: log-job: UpdateDeadline() called on leaf txn

Query:

        SELECT
        	tab_14996._float8 AS col_36419,
        	'1994-12-12 07:32:21.000196+00:00':::TIMESTAMPTZ AS col_36420,
        	true AS col_36421,
        	tab_14996.tableoid AS col_36422,
        	(-67545811951.52297794):::DECIMAL AS col_36423,
        	16020:::INT8 AS col_36424,
        	(SELECT tab_14996._jsonb AS col_36425 FROM defaultdb.public.table1@[0] AS tab_14997 LIMIT 1:::INT8) AS col_36426,
        	tab_14996._date AS col_36427,
        	'210.95.229.147/0':::INET AS col_36428,
        	tab_14996._int2 AS col_36429,
        	'-67 years -1 mons -422 days -10:07:03.163697':::INTERVAL AS col_36430,
        	tab_14996._float8 AS col_36431,
        	e'\x1aM':::STRING AS col_36432,
        	'morning':::greeting AS col_36433,
        	tab_14996._timestamp AS col_36434,
        	tab_14996._decimal AS col_36435,
        	'e2345563-53aa-4282-9c5e-733f9b80cd04':::UUID AS col_36436,
        	2033397740:::INT8 AS col_36437,
        	crdb_internal.replication_stream_progress(tab_14996._int8::INT8, tab_14996._string::STRING)::BYTES AS col_36438
        FROM
        	defaultdb.public.seed@seed__int8__float8__date_idx AS tab_14996
        ORDER BY
        	tab_14996._uuid, tab_14996._interval ASC, tab_14996._float8 DESC, tab_14996.tableoid DESC, tab_14996._timestamp
        LIMIT
        	78:::INT8;
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 4b41789120e019ab015e6dbb924df763897ebadb:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: no volatility for cast regclass::regnamespace

Query:

        WITH
        	with_25137 (col_148074)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							CASE
        							WHEN false THEN '71 years 1 mon 425 days 11:06:33.594088':::INTERVAL
        							ELSE '00:00:00':::INTERVAL
        							END
        						)
        				)
        					AS tab_61463 (col_148074)
        		),
        	with_25138 (col_148075)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							e'{"+fCgvBwX:EI": 0.48534867516378166, "F9dy6Ykk": {"SYZ9": {}, "wkC\'c4": [false, {}]}, "KPI=4<upn(": {}, "b": false, "foo": ["r*1xL-T,", []]}':::JSONB
        						),
        						('{}':::JSONB)
        				)
        					AS tab_61464 (col_148075)
        		)
        SELECT
        	COALESCE(tab_61465.col1_9, tab_61465.col1_5) AS col_148076,
        	tab_61465.col1_7 AS col_148077,
        	tab_61465.col1_2 AS col_148078,
        	tab_61465.col1_10 AS col_148079
        FROM
        	defaultdb.public.table1@[0] AS tab_61465
        WHERE
        	false;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 TIME NULL, col1_1 GEOMETRY NOT NULL, col1_2 VARCHAR NULL, col1_3 NAME NULL, col1_4 INET NOT NULL, col1_5 REGCLASS NOT NULL, col1_6 FLOAT8, col1_7 TIMESTAMP[] NULL, col1_8 TIME NOT NULL, col1_9 REGNAMESPACE NULL, col1_10 FLOAT4, col1_11 BOX2D, col1_12 VARCHAR NOT NULL, col1_13 FLOAT8 AS (col1_6 + col1_10) VIRTUAL, col1_14 STRING NOT NULL AS (lower(CAST(col1_1 AS STRING))) VIRTUAL, col1_15 STRING NOT NULL AS (CASE WHEN col1_5 IS NULL THEN '':::STRING ELSE '2k':::STRING END) STORED, col1_16 STRING NULL AS (lower(col1_2)) STORED, col1_17 STRING AS (lower(CAST(col1_11 AS STRING))) STORED, col1_18 STRING NOT NULL AS (lower(col1_12)) VIRTUAL, UNIQUE (col1_15 DESC, col1_0, col1_12 ASC, col1_8 ASC, col1_16, col1_14, col1_3 ASC, col1_11, col1_17 ASC, lower(CAST(col1_11 AS STRING)) ASC), INDEX (col1_18 DESC, col1_11 ASC, col1_16, lower(col1_2), col1_8 DESC, col1_15 DESC) WHERE (((((((table1.col1_0 != '24:00:00':::TIME) OR (table1.col1_10 = 0.0:::FLOAT8)) OR (table1.col1_12 >= 'X':::STRING)) OR (table1.col1_3 <= e'\x00':::STRING)) OR (table1.col1_16 <= e'\U00002603':::STRING)) AND (table1.col1_13 < '-Inf':::FLOAT8)) AND (table1.col1_14 = e'\'':::STRING)) AND (table1.col1_6 < '-Inf':::FLOAT8), FAMILY (col1_2, col1_0), FAMILY (col1_16, col1_7, col1_11, col1_12, col1_6), FAMILY (col1_17), FAMILY (col1_15, col1_9), FAMILY (col1_1, col1_4), FAMILY (col1_5), FAMILY (col1_3), FAMILY (col1_10, col1_8));
        CREATE TABLE table2 (col2_0 GEOMETRY NULL, col2_1 GEOMETRY NULL, col2_2 TIMETZ NULL, col2_3 JSONB, col2_4 REGPROCEDURE NULL, col2_5 BOOL, col2_6 UUID NULL, col2_7 STRING NULL AS (lower(CAST(col2_0 AS STRING))) VIRTUAL, UNIQUE (lower(CAST(col2_3 AS STRING))) WHERE ((table2.col2_7 <= '':::STRING) OR (NOT table2.col2_5)) OR (table2.col2_2 < '24:00:00-15:59:00':::TIMETZ), UNIQUE (col2_4 ASC, col2_6 ASC, col2_2 ASC, col2_7 ASC) STORING (col2_1));
        CREATE TABLE table3 (col3_0 UUID NOT NULL, col3_1 DATE, col3_2 INT8 NULL, col3_3 FLOAT8 NULL, col3_4 BIT(15) NULL, col3_5 NAME NULL, col3_6 INT8 NOT NULL, col3_7 BIT(43) NOT NULL, col3_8 TIME NOT NULL, col3_9 TIME, col3_10 INTERVAL NULL, col3_11 UUID NULL, col3_12 INT8 NULL AS (col3_2 + col3_6) VIRTUAL, col3_13 INT8 NULL AS (col3_2 + 3016698266218662704:::INT8) STORED, col3_14 INT8 NULL AS (col3_6 + col3_2) STORED, col3_15 FLOAT8 NOT NULL AS (col3_3 + 0.03600583349503916:::FLOAT8) STORED, col3_16 INT8 NOT NULL AS (col3_2 + col3_6) STORED, PRIMARY KEY (col3_8 DESC, col3_15 DESC, col3_16 DESC, col3_7), UNIQUE (col3_4, col3_1 ASC, col3_12, col3_14, col3_9 DESC, col3_3 ASC, (col3_3 + (-0.9529887365769545):::FLOAT8) DESC, col3_10 ASC, col3_2, lower(CAST(col3_1 AS STRING)) DESC) WHERE ((table3.col3_12 >= 9223372036854775807:::INT8) OR (table3.col3_2 != (-2147483648):::INT8)) AND (table3.col3_8 <= '24:00:00':::TIME), INDEX (col3_5) STORING (col3_0, col3_1, col3_2, col3_3, col3_6, col3_9, col3_10, col3_13), INDEX (col3_16, col3_12 ASC) STORING (col3_0, col3_1, col3_2, col3_4, col3_6, col3_10, col3_13, col3_14), FAMILY (col3_3, col3_8, col3_11, col3_4, col3_9, col3_13, col3_16), FAMILY (col3_0, col3_15, col3_6, col3_14, col3_2), FAMILY (col3_1, col3_10), FAMILY (col3_7, col3_5));
        ALTER TABLE table1 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 12597193663, "histo_col_type": "", "name": "__auto__", "null_count": 15251305350, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 17001667537, "histo_col_type": "", "name": "__auto__", "null_count": 25318187853, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 17471026743, "histo_col_type": "", "name": "__auto__", "null_count": 27419841572, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1718474728, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 16068709320, "histo_buckets": [{"distinct_range": 0, "num_eq": 8921685675436804444, "num_range": 0, "upper_bound": "6<[RU_"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 29534318700, "histo_col_type": "", "name": "__auto__", "null_count": 21262278423, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3198309139, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 27965812538, "histo_col_type": "", "name": "__auto__", "null_count": 21947642307, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6639890214, "histo_col_type": "", "name": "__auto__", "null_count": 238431113, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1503669699, "histo_col_type": "", "name": "__auto__", "null_count": 24102322051, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1473160088, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 20172820012, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5615537962, "histo_col_type": "", "name": "__auto__", "null_count": 8107144301, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 19374088460, "histo_col_type": "", "name": "__auto__", "null_count": 21587593495, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 12084969061, "histo_col_type": "", "name": "__auto__", "null_count": 12221701162, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2293128725, "histo_col_type": "", "name": "__auto__", "null_count": 26196119919, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 25633779719, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1731948209, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 30000000000}, {"avg_size": 0, "columns": ["col1_18"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4397224072, "histo_buckets": [{"distinct_range": 0, "num_eq": 400000, "num_range": 0, "upper_bound": ""}, {"distinct_range": 0, "num_eq": 200000, "num_range": 0, "upper_bound": "\\u0008iv\\u0002\\u0019``"}, {"distinct_range": 486560.5706820292, "num_eq": 1000000000, "num_range": 800000, "upper_bound": ";\\\\U\\u0007S8M\\u000e"}, {"distinct_range": 28859920.002366986, "num_eq": 873722967826246105, "num_range": 50000000, "upper_bound": "~v\\rN}\\u001a\\u0014"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 30000000000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6826637560298427905, "histo_col_type": "", "name": "__auto__", "null_count": 789595298127406894, "row_count": 8928117155300546144}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8554883760507382867, "histo_col_type": "", "name": "__auto__", "null_count": 8044335166170189206, "row_count": 8928117155300546144}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1337189847528259420, "histo_buckets": [{"distinct_range": 0, "num_eq": 70000000000, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 8256838715554960000, "num_eq": 0, "num_range": 8256838715554960073, "upper_bound": "282948212"}, {"distinct_range": 6722.214992735491, "num_eq": 80000, "num_range": 7000, "upper_bound": "477027910"}, {"distinct_range": 0, "num_eq": 50000, "num_range": 6846302491937536169, "upper_bound": "614427264"}, {"distinct_range": 1123026815.5080397, "num_eq": 4116614830432483101, "num_range": 7000000000, "upper_bound": "749504540"}, {"distinct_range": 535938912152923200, "num_eq": 10000, "num_range": 1094077351924041684, "upper_bound": "2633741590"}, {"distinct_range": 0, "num_eq": 0, "num_range": 9000000, "upper_bound": "3045815876"}, {"distinct_range": 100000000, "num_eq": 577141698994654536, "num_range": 100000000, "upper_bound": "3761112980"}, {"distinct_range": 6858201.035537565, "num_eq": 8384971272307017891, "num_range": 10000000, "upper_bound": "4226698834"}], "histo_col_type": "REGPROCEDURE", "name": "__auto__", "null_count": 3640526759200848087, "row_count": 8928117155300546144}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5073880797350493873, "histo_col_type": "", "name": "__auto__", "null_count": 8669874694789347048, "row_count": 8928117155300546144}, {"avg_size": 0, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2206626027395068488, "histo_col_type": "", "name": "__auto__", "null_count": 1889460699692046561, "row_count": 8928117155300546144}, {"avg_size": 0, "columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4012437530684165998, "histo_col_type": "", "name": "__auto__", "null_count": 3424263293064226404, "row_count": 8928117155300546144}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6198964724850090390, "histo_col_type": "", "name": "__auto__", "null_count": 7115635236867004160, "row_count": 8928117155300546144}, {"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4056008271306755490, "histo_col_type": "", "name": "__auto__", "null_count": 1180612197522026530, "row_count": 8928117155300546144}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 17, "histo_buckets": [{"distinct_range": 0, "num_eq": 900, "num_range": 0, "upper_bound": "000000000000000"}, {"distinct_range": 0, "num_eq": 5000, "num_range": 4926390711538531907, "upper_bound": "000110000110001"}, {"distinct_range": 2761.136413897631, "num_eq": 400, "num_range": 3000, "upper_bound": "001001010000001"}, {"distinct_range": 467453.96830562805, "num_eq": 7192862545818988620, "num_range": 600000, "upper_bound": "001101101110100"}, {"distinct_range": 125.42301611704798, "num_eq": 0, "num_range": 400, "upper_bound": "100010100011101"}, {"distinct_range": 4522340540.922013, "num_eq": 561988434977076920, "num_range": 10000000000, "upper_bound": "101010100010011"}, {"distinct_range": 0, "num_eq": 1622754112508417038, "num_range": 8370739038066895482, "upper_bound": "110000001010001"}, {"distinct_range": 646376569960621200, "num_eq": 1000000000, "num_range": 646376569960621237, "upper_bound": "110011110101000"}, {"distinct_range": 0, "num_eq": 2076595225762603571, "num_range": 800000000, "upper_bound": "111000110010001"}], "histo_col_type": "BIT(15)", "name": "__auto__", "null_count": 2, "row_count": 40}, {"avg_size": 0, "columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 15, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 40}, {"avg_size": 0, "columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 19, "histo_col_type": "", "name": "__auto__", "null_count": 2, "row_count": 40}, {"avg_size": 0, "columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7, "histo_col_type": "", "name": "__auto__", "null_count": 8, "row_count": 40}, {"avg_size": 0, "columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 23, "histo_col_type": "", "name": "__auto__", "null_count": 22, "row_count": 40}, {"avg_size": 0, "columns": ["col3_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 38, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 40}, {"avg_size": 0, "columns": ["col3_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 29, "histo_buckets": [{"distinct_range": 0, "num_eq": 6000000000, "num_range": 0, "upper_bound": "-8436671352950903899"}, {"distinct_range": 0, "num_eq": 5197626627465496893, "num_range": 1452739660401486602, "upper_bound": "-7981814488909226144"}, {"distinct_range": 0, "num_eq": 8000, "num_range": 50000000, "upper_bound": "-3818562883320799612"}, {"distinct_range": 3892418013429499400, "num_eq": 200, "num_range": 7965583878997358826, "upper_bound": "379262264972678492"}, {"distinct_range": 0, "num_eq": 3961211998800330485, "num_range": 80000000, "upper_bound": "2140981658724214343"}, {"distinct_range": 300726819.08863413, "num_eq": 1000000000, "num_range": 500000000, "upper_bound": "3642011392858157686"}, {"distinct_range": 22.61625278998779, "num_eq": 7280276516399037180, "num_range": 40, "upper_bound": "3730447936617651948"}, {"distinct_range": 90000000000, "num_eq": 0, "num_range": 90000000000, "upper_bound": "5971304038382196738"}], "histo_col_type": "INT8", "name": "__auto__", "null_count": 0, "row_count": 40}, {"avg_size": 0, "columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 39, "histo_col_type": "", "name": "__auto__", "null_count": 26, "row_count": 40}, {"avg_size": 0, "columns": ["col3_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 37, "histo_col_type": "", "name": "__auto__", "null_count": 4, "row_count": 40}, {"avg_size": 0, "columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 39, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 40}, {"avg_size": 0, "columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 37, "histo_col_type": "", "name": "__auto__", "null_count": 14, "row_count": 40}, {"avg_size": 0, "columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 26, "histo_col_type": "", "name": "__auto__", "null_count": 6, "row_count": 40}, {"avg_size": 0, "columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 14, "histo_col_type": "", "name": "__auto__", "null_count": 33, "row_count": 40}, {"avg_size": 0, "columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 15, "histo_col_type": "", "name": "__auto__", "null_count": 14, "row_count": 40}, {"avg_size": 0, "columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 21, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 40}, {"avg_size": 0, "columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 21, "histo_buckets": [{"distinct_range": 0, "num_eq": 30, "num_range": 0, "upper_bound": "16:11:59.065766"}, {"distinct_range": 0, "num_eq": 170085444143261867, "num_range": 8629050083645823940, "upper_bound": "21:21:34.668358"}, {"distinct_range": 2415737807609039000, "num_eq": 3063892623556410047, "num_range": 7613764694998568758, "upper_bound": "22:39:04.781694"}, {"distinct_range": 0, "num_eq": 9000, "num_range": 100, "upper_bound": "24:00:00"}], "histo_col_type": "TIME", "name": "__auto__", "null_count": 0, "row_count": 40}, {"avg_size": 0, "columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 30, "histo_col_type": "", "name": "__auto__", "null_count": 8, "row_count": 40}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('nkyc', 'jzgf', 'qqso');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith871690868
--- FAIL: TestRandomSyntaxSQLSmith (326.95s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 365b4da8bd02c06ee59d2130a56dec74ffc9ce21:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: crdb_internal.replication_stream_progress(): job 1: log-job: UpdateDeadline() called on leaf txn

Query:

        SELECT
        	43116200350124.25237:::DECIMAL AS col_197477,
        	'f59d582c-7924-42ad-8d27-78240e9c1419':::UUID AS col_197478,
        	604607040957027687:::INT8 AS col_197479,
        	tab_86661._float4 AS col_197480,
        	crdb_internal.replication_stream_progress(tab_86661._int8::INT8, tab_86661._string::STRING)::BYTES AS col_197481,
        	tab_86661._int4 AS col_197482,
        	1656354120:::OID AS col_197483,
        	tab_86661._float4 AS col_197484,
        	'28.3.159.59/7':::INET AS col_197485,
        	tab_86661._date AS col_197486,
        	tab_86661._string AS col_197487
        FROM
        	defaultdb.public.seed@seed__int8__float8__date_idx AS tab_86661
        LIMIT
        	34:::INT8;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 "char" NOT NULL, col1_1 OID NULL, col1_2 VARCHAR NULL, col1_3 BOOL[] NULL, col1_4 STRING NOT NULL AS (lower(col1_0)) STORED, PRIMARY KEY (col1_4 ASC, col1_0 DESC), INDEX (col1_4) STORING (col1_1, col1_2) WHERE (table1.col1_0 != '"':::STRING) AND (table1.col1_4 < e'\'':::STRING), INVERTED INDEX (col1_0, col1_4, col1_2 DESC, col1_3), INVERTED INDEX (col1_1 ASC, col1_4 ASC, col1_3 ASC) WHERE (table1.col1_2 < e'\'':::STRING) OR (table1.col1_4 = 'X':::STRING), INVERTED INDEX (col1_2 ASC, col1_4, col1_0, col1_3 ASC));
        ALTER TABLE table1 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6747193595016163988, "histo_buckets": [{"distinct_range": 0, "num_eq": 4221300331950791491, "num_range": 0, "upper_bound": "1421271350"}, {"distinct_range": 640551.6202971229, "num_eq": 2772813106532882366, "num_range": 1000000, "upper_bound": "1608027274"}, {"distinct_range": 46011289910.09155, "num_eq": 9043708632265168289, "num_range": 70000000000, "upper_bound": "3942856864"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 6446648483045060330, "row_count": 9155004458131637830}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8856934561888668648, "histo_col_type": "VARCHAR", "name": "__auto__", "null_count": 3437087749766041191, "row_count": 9155004458131637830}, {"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 979400337108930388, "histo_col_type": "", "name": "__auto__", "null_count": 6668602593429363467, "row_count": 9155004458131637830}, {"avg_size": 0, "columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5738205510966279640, "histo_buckets": [{"distinct_range": 0, "num_eq": 6207020902330632355, "num_range": 0, "upper_bound": ""}, {"distinct_range": 35.84256337620401, "num_eq": 10000000, "num_range": 100, "upper_bound": "\\t\\r\\u0002\\r-"}, {"distinct_range": 2000000, "num_eq": 20000000, "num_range": 2000000, "upper_bound": "\\nH(A\\u0018"}, {"distinct_range": 6530269032040209000, "num_eq": 90000000000, "num_range": 6530269032040209010, "upper_bound": "\'"}, {"distinct_range": 12038518.103883825, "num_eq": 7731281591903861075, "num_range": 70000000, "upper_bound": ",<"}, {"distinct_range": 0, "num_eq": 20000000, "num_range": 500, "upper_bound": ">kCk&K6,"}, {"distinct_range": 4952871697485890000, "num_eq": 6000, "num_range": 4952871697485889795, "upper_bound": "X"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 9155004458131637830}, {"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8701426933951186908, "histo_col_type": "\\"char\\"", "name": "__auto__", "null_count": 0, "row_count": 9155004458131637830}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('nqww', 'oybq', 'zyxwxq', 'sm', 'pzf', 'shypx');
        CREATE TYPE rand_typ_1 AS ENUM ('x', 'qhzew', 'ywkw', 'if');
        CREATE TYPE rand_typ_2 AS ENUM ('uhoyfu', 'g', 'fp', 'xpcj', 'fpiyhd');
        CREATE TYPE rand_typ_3 AS ENUM ('orw', 'd', 'lhcgz', 'bvvf', 'butu');
        CREATE TYPE rand_typ_4 AS ENUM ('vs', 'ogk', 'qg', 'tcb');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith1108721062
--- FAIL: TestRandomSyntaxSQLSmith (300.85s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 912964e02ddd951c77d4f71981ae18b3894e9084:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: crdb_internal.replication_stream_progress(): job -6935248201646024761: log-job: UpdateDeadline() called on leaf txn

Query:

        SELECT
        	tab_90027._jsonb AS col_186765,
        	tab_90026._int2 AS col_186766,
        	tab_90026._timestamptz AS col_186767,
        	(-8574852.906215129015):::DECIMAL AS col_186768,
        	tab_90027._bytes AS col_186769,
        	tab_90027._enum AS col_186770,
        	tab_90027._uuid AS col_186771,
        	tab_90026._bool AS col_186772,
        	crdb_internal.replication_stream_progress((-6935248201646024761):::INT8::INT8, tab_90026._string::STRING)::BYTES
        		AS col_186773,
        	NULL AS col_186774
        FROM
        	defaultdb.public.seed@seed__int8__float8__date_idx AS tab_90026,
        	defaultdb.public.seed@seed__int8__float8__date_idx AS tab_90027
        ORDER BY
        	tab_90027._float4;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 INET NOT NULL, PRIMARY KEY (col1_0), UNIQUE (col1_0 ASC));
        ALTER TABLE table1 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2245711867850705623, "histo_buckets": [{"distinct_range": 0, "num_eq": 4761307698476938299, "num_range": 0, "upper_bound": "81.14.78.74/21"}, {"distinct_range": 100000, "num_eq": 4000000000, "num_range": 100000, "upper_bound": "203.244.55.153/21"}, {"distinct_range": 1335339479430641200, "num_eq": 2322622292757811038, "num_range": 7984169117419033308, "upper_bound": "65da:558f:1b42:296f:c132:158d:c927:3708/18"}], "histo_col_type": "INET", "name": "__auto__", "null_count": 0, "row_count": 6623714287764592214}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('c', 'njqvp');
        CREATE TYPE rand_typ_1 AS ENUM ('qstv', 'nmlic', 'ed', 'djzt', 'zgjn', 'm');
        CREATE TYPE rand_typ_2 AS ENUM ('d', 'tdio');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith3875081813
--- FAIL: TestRandomSyntaxSQLSmith (300.75s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ da01e4c0545f191a0573e1d097ff0366769e0d6b:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: crdb_internal.replication_stream_progress(): job 1: log-job: UpdateDeadline() called on leaf txn

Query:

        SELECT
        	NULL AS col_1455212,
        	tab_640849._enum AS col_1455213,
        	crdb_internal.replication_stream_progress(tab_640849._int2::INT8, tab_640849._string::STRING)::BYTES AS col_1455214,
        	date_trunc('':::STRING::STRING, '10:51:07.670424':::TIME::TIME)::INTERVAL AS col_1455215,
        	(-813586.7856737977272):::DECIMAL AS col_1455216,
        	'cdcbd944-ffdd-4cf5-833b-2d3dedd8abf8':::UUID AS col_1455217,
        	tab_640849._timestamptz AS col_1455218,
        	NULL AS col_1455219,
        	tab_640849.tableoid AS col_1455220
        FROM
        	defaultdb.public.seed@seed__int8__float8__date_idx AS tab_640849
        WHERE
        	true
        ORDER BY
        	tab_640849.crdb_internal_mvcc_timestamp ASC;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 DATE NOT NULL, col1_1 FLOAT8 NOT NULL, col1_2 STRING NOT NULL AS (lower(CAST(col1_0 AS STRING))) VIRTUAL, PRIMARY KEY (col1_1 ASC, col1_0 DESC, col1_2 DESC));
        CREATE TABLE table2 (col2_0 DATE NULL, col2_1 REGPROCEDURE NULL, col2_2 BOX2D NOT NULL, col2_3 JSONB NOT NULL, col2_4 BOX2D NOT NULL, col2_5 GEOGRAPHY NOT NULL, col2_6 REGPROC NOT NULL, col2_7 BIT(49) NOT NULL, col2_8 CHAR NULL, col2_9 BOX2D, col2_10 DECIMAL[] NULL, col2_11 INT4, INDEX ((CASE WHEN col2_10 IS NULL THEN e'\x03]_\'\r':::STRING ELSE e'\x0ePV$WlQ5':::STRING END)) WHERE ((table2.col2_11 != (-2147483648):::INT8) AND (table2.col2_0 = '1970-01-01':::DATE)) OR (table2.col2_8 <= 'X':::STRING), UNIQUE (col2_8 DESC, col2_11 DESC) WHERE ((table2.col2_11 = (-1):::INT8) OR (table2.col2_0 >= '-infinity':::DATE)) OR (table2.col2_8 != '':::STRING), INDEX (col2_7 DESC, col2_4) STORING (col2_0, col2_5, col2_6, col2_8, col2_9, col2_10, col2_11) WHERE ((table2.col2_8 < 'X':::STRING) AND (table2.col2_11 <= 1:::INT8)) AND (table2.col2_0 < '-infinity':::DATE), UNIQUE (col2_0, col2_11), INVERTED INDEX (col2_7, col2_6 DESC, col2_4 ASC, (CASE WHEN col2_10 IS NULL THEN e'A\x0f':::STRING ELSE e'>6\x05smQ1n':::STRING END), col2_1 ASC, col2_5 DESC) WHERE ((table2.col2_0 = '-infinity':::DATE) AND (table2.col2_8 != e'\'':::STRING)) OR (table2.col2_11 < (-1):::INT8), FAMILY (col2_9), FAMILY (col2_7), FAMILY (col2_5), FAMILY (col2_1, col2_8, col2_11, col2_0, col2_4, col2_10), FAMILY (col2_6, col2_2), FAMILY (col2_3));
        ALTER TABLE table1 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 820496826745355236, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7108643160541947655}, {"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1646575282350674945, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7108643160541947655}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3977725680183080831, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7108643160541947655}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5872187390549533760, "histo_col_type": "", "name": "__auto__", "null_count": 5574555132286550759, "row_count": 8006954070547119157}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 415233186955809736, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 8006954070547119157}, {"avg_size": 0, "columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5704790533344603457, "histo_col_type": "", "name": "__auto__", "null_count": 2961348691238257477, "row_count": 8006954070547119157}, {"avg_size": 0, "columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 425516097355151602, "histo_col_type": "", "name": "__auto__", "null_count": 5553076252519584728, "row_count": 8006954070547119157}, {"avg_size": 0, "columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6560698695049532008, "histo_col_type": "", "name": "__auto__", "null_count": 21984607025584518, "row_count": 8006954070547119157}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1406700091634100053, "histo_buckets": [{"distinct_range": 0, "num_eq": 420844028881372636, "num_range": 0, "upper_bound": "-infinity"}, {"distinct_range": 10000000000, "num_eq": 30, "num_range": 10000000000, "upper_bound": "1970-05-08"}, {"distinct_range": 791062862778760700, "num_eq": 8187550530243576879, "num_range": 6479063474793966186, "upper_bound": "1972-01-08"}, {"distinct_range": 338.600333802894, "num_eq": 10000000000, "num_range": 500, "upper_bound": "1972-08-06"}, {"distinct_range": 0, "num_eq": 30000000000, "num_range": 200000, "upper_bound": "1984-06-15"}, {"distinct_range": 2640953741329142000, "num_eq": 5864332483533974576, "num_range": 3550966339353826461, "upper_bound": "1987-11-05"}], "histo_col_type": "DATE", "name": "__auto__", "null_count": 3852580501533474432, "row_count": 8006954070547119157}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2610000743404796796, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 8006954070547119157}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1206454781112301711, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 8006954070547119157}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7002638586234178347, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 8006954070547119157}, {"avg_size": 0, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 669202784223841219, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 8006954070547119157}, {"avg_size": 0, "columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6075478890072990579, "histo_buckets": [{"distinct_range": 0, "num_eq": 90, "num_range": 0, "upper_bound": "0010111100001101110000011101110010001001101101010"}], "histo_col_type": "BIT(49)", "name": "__auto__", "null_count": 0, "row_count": 8006954070547119157}, {"avg_size": 0, "columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1931700130795373779, "histo_buckets": [{"distinct_range": 0, "num_eq": 4454601322294429321, "num_range": 0, "upper_bound": "\\u001c"}, {"distinct_range": 0, "num_eq": 90000, "num_range": 3000000000, "upper_bound": "="}], "histo_col_type": "CHAR", "name": "__auto__", "null_count": 6154238067726191766, "row_count": 8006954070547119157}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('j', 'bxyg');
        CREATE TYPE rand_typ_1 AS ENUM ('lxnveb', 'ix', 't');
        CREATE TYPE rand_typ_2 AS ENUM ('bvdzqr', 'du', 'dkduo', 'dynhj', 'dqk');
        CREATE TYPE rand_typ_3 AS ENUM ('gdivqy', 'ly', 'tpwn', 'hqhh');
        CREATE TYPE rand_typ_4 AS ENUM ('qynn', 'e', 'c', 'illos', 'pihy', 'nij');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith2052154260
--- FAIL: TestRandomSyntaxSQLSmith (300.77s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 58ceac139a7e83052171121b28026a7366f16f7e:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: crdb_internal.replication_stream_progress(): job 1: log-job: UpdateDeadline() called on leaf txn

Query:

        SELECT
        	crdb_internal.replication_stream_progress(tab_160271._int2::INT8, tab_160271._string::STRING)::BYTES AS col_375281,
        	'{"S-N8": [], "X+<f/": false}':::JSONB AS col_375282,
        	(-960584796):::INT8 AS col_375283,
        	tab_160271._string AS col_375284,
        	'53 years 9 mons 624 days 24:39:23.792089':::INTERVAL AS col_375285,
        	NULL AS col_375286,
        	'4ff3:e0e6:fb74:4b34:65b5:3437:c14e:58bf/113':::INET AS col_375287,
        	tab_160271._enum AS col_375288,
        	(tab_160271._int4::INT8 % (8.963841011309478894E+31:::DECIMAL::DECIMAL // (-7108178376750120226):::INT8::INT8)::DECIMAL::DECIMAL)::DECIMAL
        		AS col_375289,
        	tab_160271._timestamp AS col_375290,
        	'2018-04-14 04:32:11.000636+00:00':::TIMESTAMPTZ AS col_375291,
        	'NaN':::DECIMAL AS col_375292,
        	'1986-12-27':::DATE AS col_375293,
        	(-0.7814640998840332):::FLOAT8 AS col_375294,
        	tab_160271._bool AS col_375295,
        	(-2.2028558977826593):::FLOAT8 AS col_375296,
        	'00000000-0000-0000-0000-000000000000':::UUID AS col_375297,
        	NULL AS col_375298,
        	tab_160271.tableoid AS col_375299
        FROM
        	defaultdb.public.seed@seed__int8__float8__date_idx AS tab_160271
        ORDER BY
        	tab_160271._int2
        LIMIT
        	73:::INT8;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 GEOGRAPHY NOT NULL, col1_1 REGPROCEDURE NULL, col1_2 GEOGRAPHY NOT NULL, col1_3 BOX2D NOT NULL, col1_4 STRING NOT NULL AS (lower(CAST(col1_2 AS STRING))) VIRTUAL, INDEX (col1_4 ASC) STORING (col1_2) WHERE table1.col1_4 <= e'\x00':::STRING, INVERTED INDEX (col1_1, col1_4 ASC, col1_0) WHERE table1.col1_4 = 'X':::STRING, INVERTED INDEX (col1_0 DESC) WHERE table1.col1_4 != '"':::STRING);
        CREATE TABLE table2 (col2_0 UUID NOT NULL, col2_1 "char" NULL, col2_2 JSONB, col2_3 DATE NOT NULL, col2_4 GEOGRAPHY NOT NULL, col2_5 REGROLE, col2_6 BOOL NULL, INVERTED INDEX (col2_5 DESC, col2_3, col2_2 ASC), INVERTED INDEX (col2_0 DESC, col2_5 ASC, col2_2 DESC) WHERE ((table2.col2_1 < e'\x00':::STRING) AND table2.col2_6) AND (table2.col2_3 != '-infinity':::DATE), INDEX (lower(CAST(col2_2 AS STRING)) ASC, (CASE WHEN col2_3 IS NULL THEN '"':::STRING ELSE e':Y\x17':::STRING END) DESC) WHERE (table2.col2_1 = e'\'':::STRING) OR table2.col2_6, FAMILY (col2_6, col2_5, col2_1), FAMILY (col2_4), FAMILY (col2_2, col2_0, col2_3));
        CREATE TABLE table3 (col3_0 OID, col3_1 BYTES NOT NULL, col3_2 BOX2D, col3_3 REGTYPE NULL, col3_4 GEOGRAPHY NOT NULL, col3_5 BOX2D NULL, col3_6 INTERVAL NOT NULL, col3_7 "char", col3_8 STRING NOT NULL AS (lower(CAST(col3_4 AS STRING))) VIRTUAL, col3_9 STRING NOT NULL AS (CASE WHEN col3_6 IS NULL THEN e'\x12|9\x0em}':::STRING ELSE '':::STRING END) STORED, col3_10 STRING AS (lower(CAST(col3_2 AS STRING))) STORED, col3_11 STRING AS (lower(col3_7)) VIRTUAL, col3_12 STRING NOT NULL AS (lower(CAST(col3_4 AS STRING))) STORED, col3_13 STRING NULL AS (lower(CAST(col3_5 AS STRING))) VIRTUAL, INDEX (col3_7 ASC, col3_12 DESC, col3_0) STORING (col3_1, col3_2, col3_3, col3_9) WHERE ((((table3.col3_9 >= '':::STRING) OR (table3.col3_12 != 'X':::STRING)) AND (table3.col3_11 != e'\x00':::STRING)) AND (table3.col3_1 != '\xe29883':::BYTES)) AND (table3.col3_13 < e'\'':::STRING));
        CREATE TABLE table4 (col4_0 FLOAT8 NULL, col4_1 UUID, col4_2 JSONB NULL, col4_3 FLOAT4 NULL, col4_4 GEOMETRY NULL, col4_5 REGPROCEDURE, col4_6 INET, col4_7 TIMETZ NULL, col4_8 CHAR NULL, col4_9 "char" NULL, col4_10 VARCHAR NOT NULL, col4_11 FLOAT8 NULL AS (col4_0 + col4_3) VIRTUAL, col4_12 STRING NOT NULL AS (lower(col4_10)) VIRTUAL, col4_13 FLOAT4 NULL AS (col4_3 + col4_0) STORED, col4_14 FLOAT8 NULL AS (col4_0 + col4_3) STORED, col4_15 FLOAT4 NULL AS (col4_3 + col4_0) VIRTUAL, UNIQUE (col4_14, col4_1, lower(CAST(col4_1 AS STRING)) ASC, col4_12, col4_3 ASC, col4_8 ASC, col4_6 ASC), FAMILY (col4_1), FAMILY (col4_10), FAMILY (col4_9), FAMILY (col4_2), FAMILY (col4_5), FAMILY (col4_7, col4_13), FAMILY (col4_0, col4_14, col4_3, col4_8), FAMILY (col4_4), FAMILY (col4_6));
        CREATE TABLE table5 (col5_0 GEOGRAPHY NOT NULL, col5_1 FLOAT4 NULL, col5_2 NAME NULL, col5_3 OID, col5_4 INT8 NOT NULL, col5_5 REGPROC NOT NULL, col5_6 UUID NOT NULL, col5_7 GEOGRAPHY NULL, col5_8 VARCHAR NULL, col5_9 BYTES NULL, col5_10 INT2 NOT NULL, col5_11 INT8 NOT NULL AS (col5_4 + col5_10) VIRTUAL, INDEX (col5_9 ASC, col5_2 DESC, col5_1, lower(CAST(col5_7 AS STRING)) DESC, col5_5 DESC, col5_4 DESC, col5_8 ASC), FAMILY (col5_10, col5_1, col5_2, col5_4, col5_6), FAMILY (col5_8), FAMILY (col5_0), FAMILY (col5_9), FAMILY (col5_7), FAMILY (col5_5, col5_3));
        ALTER TABLE table1 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 786859, "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 326414, "histo_buckets": [{"distinct_range": 0, "num_eq": 6724591307262231696, "num_range": 0, "upper_bound": "\\\\x42fd100000000000000000c00921fb54442d18bff913e357a95c61400921fb54442d183ff8fbf1b1cab624"}, {"distinct_range": 0, "num_eq": 8000000, "num_range": 4367114330831965322, "upper_bound": "\\\\x42fd1055400000000000003fc657184ae744853fc657184ae744763fe921fb54442d173fe921fb54442d1c"}, {"distinct_range": 155510433580140350, "num_eq": 5920472208324027433, "num_range": 373049302223436114, "upper_bound": "\\\\x42fd1140000000000000003fc657184ae744853fc657184ae744763fe921fb54442d173fe921fb54442d1c"}, {"distinct_range": 3045930438114502700, "num_eq": 5508585787007138632, "num_range": 5078690304076487391, "upper_bound": "\\\\x42fd11aab00000000000003fc657184ae744853fc657184ae744763fe921fb54442d173fe921fb54442d1c"}, {"distinct_range": 0, "num_eq": 30000, "num_range": 20000, "upper_bound": "\\\\x42fd1300000000000000003fc657184ae744853fc657184ae744763fe921fb54442d173fe921fb54442d1c"}, {"distinct_range": 0, "num_eq": 6206488976564156204, "num_range": 8588823980248144817, "upper_bound": "\\\\x42fd1500000000000000003fc657184ae744853fc657184ae744763fe921fb54442d173fe921fb54442d1c"}, {"distinct_range": 4712427495465560000, "num_eq": 800, "num_range": 4712427495465559651, "upper_bound": "\\\\x42fd1637d7c0e8fd7e01003fc657184ae744853fc657184ae744763fe921fb54442d173fe921fb54442d1c"}, {"distinct_range": 0, "num_eq": 769611000159693777, "num_range": 200000000, "upper_bound": "\\\\x42fd27f999f91cf96eb5003fe411e6a90a6792bfe893c4ac17f3b03ff8945290886a7b3ff8a336e479f30d"}, {"distinct_range": 4493314204.345137, "num_eq": 70, "num_range": 8000000000, "upper_bound": "\\\\x42fd300000000000000000c00921fb54442d18bff913e357a95c61400921fb54442d183ff8fbf1b1cab624"}, {"distinct_range": 0, "num_eq": 100000, "num_range": 6405205181127822037, "upper_bound": "\\\\x42fd3fdf7df8a77df80b003fc657184ae744853fc657184ae744763fe921fb54442d173fe921fb54442d1c"}, {"distinct_range": 2412515599659130400, "num_eq": 80000000, "num_range": 3878499512339184744, "upper_bound": "\\\\x42fd4100000000000000003fc657184ae744853fc657184ae744763fe921fb54442d173fe921fb54442d1c"}, {"distinct_range": 358853936.8276851, "num_eq": 6226411272725126407, "num_range": 900000000, "upper_bound": "\\\\x42fd4556ba185e9f9d71003fe411e6a90a6792bfe893c4ac17f3b03ff8945290886a7b3ff8a336e479f30d"}, {"distinct_range": 978058258487579000, "num_eq": 732189673501710340, "num_range": 5610655245079646932, "upper_bound": "\\\\x42fd4750000000000000003fc657184ae744853fc657184ae744763fe921fb54442d173fe921fb54442d1c"}, {"distinct_range": 2601746686162397700, "num_eq": 7031330930610779931, "num_range": 7816422677623709373, "upper_bound": "\\\\x42fd500000000000000000c00921fb54442d18bff913e357a95c61400921fb54442d183ff8fbf1b1cab624"}, {"distinct_range": 0, "num_eq": 4020768963388815201, "num_range": 80000000, "upper_bound": "\\\\x42fd700000000000000000c00921fb54442d18bff913e357a95c61400921fb54442d183ff8fbf1b1cab624"}, {"distinct_range": 2162844507073381000, "num_eq": 100, "num_range": 2162844507073381195, "upper_bound": "\\\\x42fd900000000000000000c00921fb54442d18bff913e357a95c61400921fb54442d183ff8fbf1b1cab624"}, {"distinct_range": 0, "num_eq": 200000000, "num_range": 3236688879362541945, "upper_bound": "\\\\x42fd95b61cd76c1afb7f01bff11c8eec35fdd9bfe234ae3b3e047c"}, {"distinct_range": 0, "num_eq": 6936368686031682639, "num_range": 6869915173802926233, "upper_bound": "\\\\x42fdb00000000000000000c00921fb54442d18bff913e357a95c61400921fb54442d183ff8fbf1b1cab624"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 581395, "histo_buckets": [{"distinct_range": 0, "num_eq": 4490349007364103148, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 2654527578883536400, "num_eq": 3276702052093904987, "num_range": 2654527578883536182, "upper_bound": "424697491"}, {"distinct_range": 0, "num_eq": 800, "num_range": 900, "upper_bound": "532747644"}, {"distinct_range": 36140730161.648125, "num_eq": 9000000, "num_range": 50000000000, "upper_bound": "2161306881"}, {"distinct_range": 3621777837733880000, "num_eq": 643937116021481186, "num_range": 3621777837733879833, "upper_bound": "2908131528"}, {"distinct_range": 0, "num_eq": 8703770230295222261, "num_range": 10000, "upper_bound": "3897039678"}, {"distinct_range": 50000, "num_eq": 50000000000, "num_range": 50000, "upper_bound": "3944358129"}], "histo_col_type": "REGPROCEDURE", "name": "__auto__", "null_count": 10552, "row_count": 1000000}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 403236, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 956603, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2445417747455765132, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4841788773207000650}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 663889300267818348, "histo_buckets": [{"distinct_range": 0, "num_eq": 7670782299366481343, "num_range": 0, "upper_bound": "401098585"}, {"distinct_range": 0, "num_eq": 950459052029285659, "num_range": 8740555868000833, "upper_bound": "2182553194"}, {"distinct_range": 0, "num_eq": 20000000, "num_range": 20000000000, "upper_bound": "2352507202"}, {"distinct_range": 541.1758612103442, "num_eq": 5507849930721078177, "num_range": 800, "upper_bound": "2870276890"}, {"distinct_range": 353129976298367940, "num_eq": 7139354792012060126, "num_range": 448102352472891797, "upper_bound": "3084116768"}, {"distinct_range": 2327056962040732000, "num_eq": 7738133682644826028, "num_range": 3893475884955687203, "upper_bound": "3171971363"}, {"distinct_range": 9000000000, "num_eq": 6183987400271386518, "num_range": 9000000000, "upper_bound": "3196956469"}, {"distinct_range": 2000, "num_eq": 600, "num_range": 2000, "upper_bound": "3244882158"}, {"distinct_range": 18022.2277699128, "num_eq": 9000, "num_range": 70000, "upper_bound": "3765833675"}], "histo_col_type": "REGROLE", "name": "__auto__", "null_count": 1989133372536295392, "row_count": 4841788773207000650}, {"avg_size": 0, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2118270348912101214, "histo_col_type": "", "name": "__auto__", "null_count": 3671319415468161570, "row_count": 4841788773207000650}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 308305565111129842, "histo_col_type": "UUID", "name": "__auto__", "null_count": 0, "row_count": 4841788773207000650}, {"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1606322072618946860, "histo_col_type": "", "name": "__auto__", "null_count": 3868287571583051208, "row_count": 4841788773207000650}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4521577262476107073, "histo_col_type": "", "name": "__auto__", "null_count": 264612263377009086, "row_count": 4841788773207000650}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2677304535068987367, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4841788773207000650}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 523894382329082422, "histo_buckets": [{"distinct_range": 0, "num_eq": 1510981355952533208, "num_range": 0, "upper_bound": "\\u0001"}, {"distinct_range": 0, "num_eq": 5000, "num_range": 0, "upper_bound": "\\u0017"}, {"distinct_range": 8625017303186719000, "num_eq": 7331944698821643404, "num_range": 8625017303186718465, "upper_bound": "/"}, {"distinct_range": 60000000, "num_eq": 4108019466992358797, "num_range": 60000000, "upper_bound": "9"}, {"distinct_range": 0, "num_eq": 8000000000, "num_range": 30000, "upper_bound": "A"}, {"distinct_range": 0, "num_eq": 2000000, "num_range": 3382058357892322308, "upper_bound": "X"}], "histo_col_type": "\\"char\\"", "name": "__auto__", "null_count": 128028380558624258, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2109772489158699042, "histo_col_type": "", "name": "__auto__", "null_count": 530162786485597684, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3456314988355746389, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1375758072522772063, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3491831369236901346, "histo_col_type": "", "name": "__auto__", "null_count": 692426928446193673, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3268344315500249953, "histo_col_type": "", "name": "__auto__", "null_count": 2334305938301336653, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3701806838425036468, "histo_col_type": "", "name": "__auto__", "null_count": 2003971080477288415, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1077284260129548150, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2986203581644614664, "histo_col_type": "", "name": "__auto__", "null_count": 3146894560698618578, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2735951862798940128, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1699354276889713615, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2775312818482745961, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2831224728168498709, "histo_col_type": "", "name": "__auto__", "null_count": 794292495543124794, "row_count": 4277516330240252426}, {"avg_size": 0, "columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 368907522953232686, "histo_col_type": "", "name": "__auto__", "null_count": 3775633465597447931, "row_count": 4277516330240252426}]':::JSONB;
        ALTER TABLE table4 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col4_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3569082294059164519, "histo_col_type": "", "name": "__auto__", "null_count": 684723939796408148, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3239658145206751056, "histo_col_type": "", "name": "__auto__", "null_count": 569241343084997937, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2716659648218253626, "histo_col_type": "", "name": "__auto__", "null_count": 247861937144725031, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3181241142145122735, "histo_col_type": "", "name": "__auto__", "null_count": 278074007062515721, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 921428064166222239, "histo_col_type": "", "name": "__auto__", "null_count": 1000680919434576793, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 377618988607731639, "histo_col_type": "", "name": "__auto__", "null_count": 1525417638499232338, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4000513060715469738, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3795423742002529903, "histo_col_type": "", "name": "__auto__", "null_count": 1442246431456617815, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 420408774685492147, "histo_col_type": "", "name": "__auto__", "null_count": 2831407382348388140, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3550002845469672163, "histo_col_type": "", "name": "__auto__", "null_count": 2906697590420804245, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1774039906986545501, "histo_col_type": "", "name": "__auto__", "null_count": 2170414243751690044, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1499945579208522861, "histo_col_type": "", "name": "__auto__", "null_count": 1542976266478168598, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3456900423939520121, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 844555413801494449, "histo_col_type": "", "name": "__auto__", "null_count": 3267478953393503127, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1234014980563374595, "histo_col_type": "", "name": "__auto__", "null_count": 322362485208447835, "row_count": 4076251882291122363}, {"avg_size": 0, "columns": ["col4_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3349531289011387043, "histo_col_type": "", "name": "__auto__", "null_count": 1952300725996101318, "row_count": 4076251882291122363}]':::JSONB;
        ALTER TABLE table5 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col5_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2389429190875206262, "histo_col_type": "", "name": "__auto__", "null_count": 1347543094361664827, "row_count": 3258439008095351780}, {"avg_size": 0, "columns": ["col5_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2842025016938771790, "histo_buckets": [{"distinct_range": 0, "num_eq": 3531102898711219374, "num_range": 0, "upper_bound": "\\\\xed80b1211d15"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 591766350090728411, "row_count": 3258439008095351780}, {"avg_size": 0, "columns": ["col5_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 987538589926846657, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3258439008095351780}, {"avg_size": 0, "columns": ["col5_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1699248870029062376, "histo_col_type": "", "name": "__auto__", "null_count": 1583384127379282495, "row_count": 3258439008095351780}, {"avg_size": 0, "columns": ["col5_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 489801524116443314, "histo_col_type": "", "name": "__auto__", "null_count": 292564089821960523, "row_count": 3258439008095351780}, {"avg_size": 0, "columns": ["col5_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2783017764214915406, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3258439008095351780}, {"avg_size": 0, "columns": ["col5_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1942105530846476986, "histo_col_type": "", "name": "__auto__", "null_count": 2951910940233809720, "row_count": 3258439008095351780}, {"avg_size": 0, "columns": ["col5_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2868715266648936421, "histo_col_type": "", "name": "__auto__", "null_count": 759695485123920419, "row_count": 3258439008095351780}, {"avg_size": 0, "columns": ["col5_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 987205697860913186, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3258439008095351780}, {"avg_size": 0, "columns": ["col5_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1321750404246308654, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3258439008095351780}, {"avg_size": 0, "columns": ["col5_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 782639011943253073, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3258439008095351780}, {"avg_size": 0, "columns": ["col5_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2068146943922624126, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3258439008095351780}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('kvwyq', 'x', 'gdwbfw', 'd');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith2470676738
--- FAIL: TestRandomSyntaxSQLSmith (300.88s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ dc07599dc9db1acd5afa3a6537297815f25c1fca:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: crdb_internal.replication_stream_progress(): job 3996289481577766747: log-job: UpdateDeadline() called on leaf txn

Query:

        SELECT
        	tab_374087._uuid AS col_911309,
        	'9627:120:632:e4e4:5b22:c8fe:45e:9b02/90':::INET AS col_911310,
        	tab_374087._int4 AS col_911311,
        	'howdy':::greeting AS col_911312,
        	tab_374087._decimal AS col_911313,
        	tab_374087._bytes AS col_911314,
        	tab_374087._string AS col_911315,
        	tab_374087._int8 AS col_911316,
        	tab_374087._interval AS col_911317,
        	true AS col_911318,
        	NULL AS col_911319,
        	tab_374087._timestamp AS col_911320
        FROM
        	defaultdb.public.seed@seed__int8__float8__date_idx AS tab_374087
        WHERE
        	('\x1c26ed3deb5d48':::BYTES <= crdb_internal.replication_stream_progress(3996289481577766747:::INT8::INT8, tab_374087._string::STRING)::BYTES);

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 INET NOT NULL, col1_1 STRING NOT NULL, col1_2 CHAR NOT NULL, col1_3 REGPROCEDURE NOT NULL, col1_4 TIMESTAMPTZ NOT NULL, col1_5 INT8 NOT NULL, col1_6 INTERVAL NOT NULL, col1_7 "char" NOT NULL, col1_8 FLOAT8 NOT NULL, col1_9 CHAR NOT NULL, col1_10 TIMESTAMPTZ NOT NULL, col1_11 STRING NOT NULL AS (lower(col1_7)) VIRTUAL, col1_12 STRING NOT NULL AS (lower(col1_2)) VIRTUAL, PRIMARY KEY (col1_12 ASC, col1_9, col1_2 ASC, col1_10 ASC, col1_3 ASC, col1_4 ASC, col1_5 ASC, col1_11, col1_8 DESC, col1_7 DESC, col1_0 ASC, col1_6 ASC, col1_1 DESC), INDEX (col1_5 ASC, col1_3 ASC, col1_4 DESC, col1_9, col1_8, col1_0, col1_11 ASC), INDEX (lower(CAST(col1_0 AS STRING)) DESC, col1_11 ASC, (col1_5 + 4915114685445141195:::INT8) ASC, col1_6) WHERE ((table1.col1_4 <= '-4713-11-24 00:00:00+00:00':::TIMESTAMPTZ) OR (table1.col1_5 <= (-9223372036854775807):::INT8)) OR (table1.col1_12 != 'X':::STRING), UNIQUE (col1_6 DESC, col1_8, col1_2 DESC, col1_3 ASC, col1_1, col1_0, col1_9 DESC, col1_12 ASC, col1_11, col1_10 ASC), UNIQUE (col1_3, col1_7 DESC, col1_11 ASC, col1_8, lower(col1_7) ASC, col1_12) WHERE (((((((((table1.col1_9 < '"':::STRING) AND (table1.col1_11 = e'\x00':::STRING)) OR (table1.col1_8 != 1.0:::FLOAT8)) AND (table1.col1_10 <= '294276-12-31 23:59:59.999999+00:00':::TIMESTAMPTZ)) AND (table1.col1_2 < 'X':::STRING)) AND (table1.col1_1 > '"':::STRING)) AND (table1.col1_4 != '0001-01-01 00:00:00+00:00':::TIMESTAMPTZ)) AND (table1.col1_12 > 'X':::STRING)) AND (table1.col1_5 > (-1):::INT8)) OR (table1.col1_7 > '"':::STRING), FAMILY (col1_5), FAMILY (col1_7, col1_0), FAMILY (col1_1, col1_10), FAMILY (col1_9, col1_2), FAMILY (col1_6), FAMILY (col1_4, col1_3), FAMILY (col1_8));
        ALTER TABLE table1 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4084857, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 742048, "histo_buckets": [{"distinct_range": 0, "num_eq": 300000000, "num_range": 0, "upper_bound": "\\u00023U\\u0005D\\u000fvQ\\u0012"}, {"distinct_range": 0, "num_eq": 3000000, "num_range": 4644094396692346748, "upper_bound": "\\u001b``"}, {"distinct_range": 7000000000, "num_eq": 500000000, "num_range": 7000000000, "upper_bound": "lV*Ln1O"}, {"distinct_range": 200000, "num_eq": 50, "num_range": 200000, "upper_bound": "t>LuEGs"}, {"distinct_range": 58997569.31528123, "num_eq": 900000, "num_range": 800000000, "upper_bound": "v}WA[\\u000fN\\u001b"}, {"distinct_range": 9137208671703990000, "num_eq": 8000, "num_range": 9137208671703990105, "upper_bound": "wh\\u001d\\u00080\\u000f\\t=7"}, {"distinct_range": 8935678839851451000, "num_eq": 60, "num_range": 8935678839851451252, "upper_bound": "|:?\\u0004\\u00059U"}, {"distinct_range": 0, "num_eq": 5059037334461825266, "num_range": 200, "upper_bound": "\x7f\\u001d0m\\u000c(\\u0001?d"}, {"distinct_range": 0, "num_eq": 100, "num_range": 0, "upper_bound": "\U00002603"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4161543, "histo_col_type": "INT8", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3229602, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 850038, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2842607, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4425323, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1914755, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2676880, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4670229, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 594023, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3384326, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1278279, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('xlwpdh', 'c', 'er', 'ytlzdz', 'sxg', 'lhmbe');
        CREATE TYPE rand_typ_1 AS ENUM ('dwso');
        CREATE TYPE rand_typ_2 AS ENUM ('tlxhy', 'y', 'v', 'j');
        CREATE TYPE rand_typ_3 AS ENUM ('zm', 'hy', 'gbbusc', 'jnta', 'y', 'wrqok');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith838435447
--- FAIL: TestRandomSyntaxSQLSmith (300.84s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ e1068d77afbd39b162978281c9da7cbea49c1c3a:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: crdb_internal.replication_stream_progress(): job 1: log-job: UpdateDeadline() called on leaf txn

Query:

        SELECT
        	crdb_internal.replication_stream_progress(tab_354108._int8::INT8, tab_354108._string::STRING)::BYTES AS col_834001,
        	tab_354108._float8 AS col_834002,
        	'2540c649-67e5-4d2e-8bc8-ac16398e3e3a':::UUID AS col_834003,
        	tab_354108._timestamptz AS col_834004,
        	tab_354108._inet AS col_834005,
        	tab_354108._string AS col_834006
        FROM
        	defaultdb.public.seed@seed__int8__float8__date_idx AS tab_354108
        LIMIT
        	18:::INT8;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 BYTES NOT NULL, col1_1 FLOAT4 NULL, col1_2 INTERVAL NOT NULL, col1_3 GEOMETRY, col1_4 TIMETZ NULL, col1_5 INET, col1_6 FLOAT4 NULL AS (col1_1 + (-1.720742106437683):::FLOAT8) VIRTUAL, UNIQUE (col1_0 DESC) STORING (col1_4), UNIQUE (col1_1 ASC, col1_6, lower(CAST(col1_3 AS STRING)) DESC), FAMILY (col1_2, col1_1, col1_0), FAMILY (col1_4), FAMILY (col1_5), FAMILY (col1_3));
        CREATE TABLE table2 (col2_0 REGCLASS, col2_1 REGNAMESPACE, col2_2 REGPROCEDURE NULL, col2_3 FLOAT8 NULL, col2_4 REGROLE NULL, col2_5 "char", col2_6 CHAR, col2_7 DECIMAL, col2_8 STRING AS (lower(col2_6)) STORED, col2_9 STRING NULL AS (CASE WHEN col2_2 IS NULL THEN e'\x14.}7\x04*AZ':::STRING ELSE '!ID5S':::STRING END) STORED, col2_10 STRING NULL AS (CASE WHEN col2_2 IS NULL THEN e'2\x1aMHfv':::STRING ELSE e'\x13\x7f$KK[':::STRING END) STORED, col2_11 STRING AS (lower(col2_5)) VIRTUAL, INDEX (col2_4 ASC, col2_5 DESC, lower(col2_6), (CASE WHEN col2_0 IS NULL THEN e'D\x07\x10\x10\x0b149Z':::STRING ELSE '':::STRING END) DESC, col2_1, col2_0 ASC, col2_10, col2_8 DESC, col2_7 DESC), UNIQUE (col2_9 DESC, col2_10 DESC, col2_2, col2_5 ASC, col2_1, col2_0 DESC, col2_8 ASC, col2_6) STORING (col2_3, col2_4, col2_7) WHERE (((((table2.col2_8 != 'X':::STRING) OR (table2.col2_7 < (-1):::DECIMAL)) OR (table2.col2_5 = e'\'':::STRING)) OR (table2.col2_11 < e'\'':::STRING)) AND (table2.col2_6 >= e'\'':::STRING)) OR (table2.col2_9 <= '':::STRING));
        ALTER TABLE table1 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1363881996295963711, "histo_col_type": "", "name": "__auto__", "null_count": 159692069401887400, "row_count": 5090516251066338510}, {"avg_size": 0, "columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3784536584602994460, "histo_col_type": "", "name": "__auto__", "null_count": 268187472054027747, "row_count": 5090516251066338510}, {"avg_size": 0, "columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3387087988829024868, "histo_col_type": "", "name": "__auto__", "null_count": 3932037986308764637, "row_count": 5090516251066338510}, {"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 112189548980171460, "histo_buckets": [{"distinct_range": 0, "num_eq": 4461715320400072786, "num_range": 0, "upper_bound": "\\\\x"}, {"distinct_range": 0, "num_eq": 4000000, "num_range": 70000, "upper_bound": "\\\\x00"}, {"distinct_range": 0, "num_eq": 30000000000, "num_range": 4204488928558075602, "upper_bound": "\\\\x0eb04694a2fc"}, {"distinct_range": 0, "num_eq": 200000, "num_range": 7666596487965096400, "upper_bound": "\\\\x5fdc13"}, {"distinct_range": 0, "num_eq": 50000000, "num_range": 7362393084494880237, "upper_bound": "\\\\x69caddbecca51f"}, {"distinct_range": 8783151118472912000, "num_eq": 6204162937491228455, "num_range": 8783151118472911646, "upper_bound": "\\\\x84"}, {"distinct_range": 0, "num_eq": 700000000, "num_range": 900000000, "upper_bound": "\\\\xc6372f63"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 0, "row_count": 5090516251066338510}, {"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4974642598477206231, "histo_buckets": [{"distinct_range": 0, "num_eq": 5510355291817631879, "num_range": 0, "upper_bound": "-0.8640015721321106"}, {"distinct_range": 256.56128340647206, "num_eq": 400, "num_range": 300, "upper_bound": "0.2096436619758606"}, {"distinct_range": 5416313674366308000, "num_eq": 30, "num_range": 5416313674366308680, "upper_bound": "0.5630896091461182"}, {"distinct_range": 434764383985053700, "num_eq": 600, "num_range": 3200751610285785021, "upper_bound": "+Inf"}], "histo_col_type": "FLOAT4", "name": "__auto__", "null_count": 2559830252367934881, "row_count": 5090516251066338510}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4530888437414858000, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5090516251066338510}, {"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3053826594318759294, "histo_col_type": "", "name": "__auto__", "null_count": 482272977863375769, "row_count": 5090516251066338510}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 80108433346506548, "histo_col_type": "", "name": "__auto__", "null_count": 43825551192196973, "row_count": 198621161880991126}, {"avg_size": 0, "columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 39964783827033139, "histo_col_type": "", "name": "__auto__", "null_count": 42165907368855201, "row_count": 198621161880991126}, {"avg_size": 0, "columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 21292557706486961, "histo_col_type": "", "name": "__auto__", "null_count": 70769663350730205, "row_count": 198621161880991126}, {"avg_size": 0, "columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 44423755681033607, "histo_col_type": "", "name": "__auto__", "null_count": 174556265755422984, "row_count": 198621161880991126}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1744960961022704, "histo_col_type": "", "name": "__auto__", "null_count": 11165587700029304, "row_count": 198621161880991126}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 31371551326434175, "histo_col_type": "", "name": "__auto__", "null_count": 172423576515124423, "row_count": 198621161880991126}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 53841269109392050, "histo_buckets": [{"distinct_range": 0, "num_eq": 7000000000, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 6635326529654574000, "num_eq": 6000000000, "num_range": 6635326529654574583, "upper_bound": "157816535"}, {"distinct_range": 480742211550474050, "num_eq": 60000000, "num_range": 1925358514031985263, "upper_bound": "739293626"}, {"distinct_range": 0, "num_eq": 200000, "num_range": 0, "upper_bound": "1767746111"}, {"distinct_range": 0, "num_eq": 8000, "num_range": 5576315118734123595, "upper_bound": "2878080741"}, {"distinct_range": 24402210.7105808, "num_eq": 6714922387779343383, "num_range": 30000000, "upper_bound": "3020600841"}, {"distinct_range": 1000000, "num_eq": 1904654360757192451, "num_range": 1000000, "upper_bound": "3050235328"}, {"distinct_range": 1408874122724555000, "num_eq": 2000000000, "num_range": 1408874122724554977, "upper_bound": "3684199803"}], "histo_col_type": "REGROLE", "name": "__auto__", "null_count": 88135768327837993, "row_count": 198621161880991126}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 144238362635086751, "histo_col_type": "", "name": "__auto__", "null_count": 134003159445431781, "row_count": 198621161880991126}, {"avg_size": 0, "columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 133915523990844612, "histo_buckets": [{"distinct_range": 0, "num_eq": 400000, "num_range": 0, "upper_bound": ""}, {"distinct_range": 0, "num_eq": 90000000, "num_range": 4000000, "upper_bound": "\\u0000"}, {"distinct_range": 600000, "num_eq": 10000000, "num_range": 600000, "upper_bound": "04"}, {"distinct_range": 0, "num_eq": 5250702514026262639, "num_range": 300, "upper_bound": "i\\u0007eO\\n ~rO"}, {"distinct_range": 15920.004613499468, "num_eq": 7102668049464226342, "num_range": 4000000, "upper_bound": "t"}, {"distinct_range": 8769414840083305000, "num_eq": 951779466914938079, "num_range": 8769414840083305105, "upper_bound": "{\\u0004 I\\u0013v"}, {"distinct_range": 7485135675.197802, "num_eq": 7385512425272675857, "num_range": 30000000000, "upper_bound": "\x7f"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 194490437535503337, "row_count": 198621161880991126}, {"avg_size": 0, "columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 81971618067117709, "histo_col_type": "", "name": "__auto__", "null_count": 906758598009308, "row_count": 198621161880991126}, {"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 11174529557434553, "histo_col_type": "", "name": "__auto__", "null_count": 122804306493749417, "row_count": 198621161880991126}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 127792328936989174, "histo_col_type": "", "name": "__auto__", "null_count": 16724536433549879, "row_count": 198621161880991126}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('v', 'jpew', 'hmiicl', 'qyrt');
        CREATE TYPE rand_typ_1 AS ENUM ('mfs', 'n', 'mliwyi', 'iyauf', 'ed');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith2712303547
--- FAIL: TestRandomSyntaxSQLSmith (317.23s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 83e2df701688745fe7e7d8a0d0e5e7a4ba8633c8:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: expected *DJSON, found tree.dNull

Query:

        WITH
        	with_150707 (col_780438, col_780439)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						('ewpy':::rand_typ_0, '1987-12-08 04:53:09.000026+00:00':::TIMESTAMPTZ),
        						('jejoaa':::rand_typ_0, '1972-05-28 18:42:22.000753+00:00':::TIMESTAMPTZ)
        				)
        					AS tab_369658 (col_780438, col_780439)
        		),
        	with_150708 (col_780440)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							crdb_internal.merge_transaction_stats((NULL::JSONB || ARRAY['{"h!>kXB": {")#E": {"3$%dYiS}_--~": [0.17050932565519566], "c": "b"}, "foo": {"baz": {"foo": 1.8581841018356013}, "foobar": {"b": {}}}, "kllk|D": []}}':::JSONB,e'[[false, {"*b/=ci``": {"G%EUt#": [], "b": null}, "b": {"baz": {}}, "fY\'JVK~_d": [], "pejCm": true}, 0.45440707879435327, {"a": []}], {}]':::JSONB,'{}':::JSONB,e'{"+M)Kow": [], "f5sz\\\\qTg@k": [[[[]], {"c": [], "foo": {"baz": false}, "hI|=qfg8M": []}], {"E\'n_tr{": {}}, [{}]]}':::JSONB,e'{"w\\"]FP[IJQ": {"1K:": [{}, {}], "UU9w.XgF": {"@3iQ:{xNwgz": []}, "\\\\XW#S": null, "qo,W<~": false}}':::JSONB]::JSONB[])::JSONB[]::JSONB[])::JSONB
        						),
        						('0.9627608458893036':::JSONB),
        						(
        							'[{"L_^{_a": {"X+qzHAx``It": [["b", null]]}, "baz": {}, "c": 1.0184470016970362, "foobar": "foo"}, [true], [{}]]':::JSONB
        						),
        						('[true, {">IX(.l]).W*": "*)baT}m/l$"}, [[[null, {}]]], true, []]':::JSONB),
        						(
        							'[{"5N$Z.XMx|!g*": null, "baz": false, "eGWpu{``vUy;": [[null], {"c": null}, [0.20823822348099316]], "x/C?;/x2j#": [[], null, 0.2853533211613676]}, true, false, {}]':::JSONB
        						),
        						(
        							e'{"]G7%J4": [{"baz": 1.258810270950451}, {"3e{^": {}, "F+-kYK;": {"a": [{}, 0.05612823442759146], "b": []}}, {"O&aZ*6llWQ+@": 0.043081045738187995}, {}], "b": {"8 \'lDV},ykj": {}}}':::JSONB
        						)
        				)
        					AS tab_369659 (col_780440)
        		)
        SELECT
        	tab_369661._float8 AS col_780441, tab_369661._inet AS col_780442
        FROM
        	defaultdb.public.table1@table1_pkey AS tab_369660
        	JOIN defaultdb.public.seed@seed__int8__float8__date_idx AS tab_369661 ON
        			(tab_369660.crdb_internal_mvcc_timestamp) = (tab_369661._decimal)
        LIMIT
        	3:::INT8;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 BOOL NOT NULL, PRIMARY KEY (col1_0), UNIQUE (col1_0 ASC) WHERE NOT table1.col1_0, UNIQUE (col1_0) WHERE table1.col1_0, INDEX (col1_0 ASC) WHERE NOT table1.col1_0, UNIQUE (lower(CAST(col1_0 AS STRING)) DESC), INDEX (col1_0 DESC) WHERE NOT table1.col1_0);
        CREATE TABLE table2 (col2_0 REGPROC NOT NULL, col2_1 DECIMAL NOT NULL, col2_2 REGPROCEDURE NOT NULL, col2_3 TIMESTAMPTZ NOT NULL, col2_4 REGPROC NOT NULL, col2_5 STRING NOT NULL AS (CASE WHEN col2_4 IS NULL THEN e'prK\r\x072':::STRING ELSE '':::STRING END) STORED, PRIMARY KEY (col2_4 DESC, col2_5, col2_1 ASC, col2_3 ASC), UNIQUE (col2_5, col2_3 DESC) STORING (col2_0) WHERE table2.col2_5 != e'\U00002603':::STRING, UNIQUE (col2_3 ASC, col2_0 ASC, col2_1, col2_5 DESC, col2_4), INDEX (col2_5 ASC) STORING (col2_0, col2_2) WHERE ((table2.col2_3 >= '294276-12-31 23:59:59.999999+00:00':::TIMESTAMPTZ) OR (table2.col2_1 < 1:::DECIMAL)) OR (table2.col2_5 >= '':::STRING), UNIQUE (col2_3, col2_0, col2_4 DESC, col2_1 DESC, col2_5, col2_2 DESC), UNIQUE (col2_4 ASC, (CASE WHEN col2_0 IS NULL THEN e'\'':::STRING ELSE e'\U00002603':::STRING END) DESC, col2_3 ASC, col2_5) WHERE (table2.col2_5 = e'\U00002603':::STRING) OR (table2.col2_3 = '3000-01-01 00:00:00+00:00':::TIMESTAMPTZ), INDEX (col2_3, col2_1 DESC), UNIQUE (col2_3, col2_2 DESC, col2_5 DESC, col2_4, (CASE WHEN col2_3 IS NULL THEN e'w1\x15':::STRING ELSE 'fc':::STRING END) DESC) WHERE table2.col2_1 >= '-Infinity':::DECIMAL, UNIQUE (col2_2 ASC, col2_1 ASC, col2_0 ASC, col2_4 ASC, col2_3 ASC) WHERE (table2.col2_1 > 'NaN':::DECIMAL) OR (table2.col2_3 < '-4713-11-24 00:00:00+00:00':::TIMESTAMPTZ), INDEX (col2_0 ASC, (CASE WHEN col2_4 IS NULL THEN e'\x103O\rvo':::STRING ELSE '<':::STRING END) ASC) WHERE ((table2.col2_1 != 0:::DECIMAL) AND (table2.col2_3 != '3000-01-01 00:00:00+00:00':::TIMESTAMPTZ)) AND (table2.col2_5 = '"':::STRING));
        ALTER TABLE table1 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 60669, "histo_buckets": [{"distinct_range": 0, "num_eq": 200000000, "num_range": 0, "upper_bound": "false"}, {"distinct_range": 100000000, "num_eq": 1096386726342818037, "num_range": 100000000, "upper_bound": "true"}], "histo_col_type": "BOOL", "name": "__auto__", "null_count": 0, "row_count": 90000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2503638112575812948, "histo_buckets": [{"distinct_range": 0, "num_eq": 900000, "num_range": 0, "upper_bound": "1972-06-02 05:26:10.000915+00:00"}, {"distinct_range": 67605265284985660, "num_eq": 7000, "num_range": 67605265284985663, "upper_bound": "1991-08-31 14:26:22.00067+00:00"}, {"distinct_range": 1000000000, "num_eq": 0, "num_range": 1000000000, "upper_bound": "1995-04-27 21:21:03.00002+00:00"}, {"distinct_range": 0, "num_eq": 5000000000, "num_range": 70, "upper_bound": "2006-08-05 08:39:37.000483+00:00"}, {"distinct_range": 0, "num_eq": 841821648734734349, "num_range": 2299205300375318869, "upper_bound": "2020-08-19 10:32:54.000992+00:00"}, {"distinct_range": 800000000, "num_eq": 0, "num_range": 800000000, "upper_bound": "2024-04-18 18:09:45.000591+00:00"}, {"distinct_range": 0, "num_eq": 10000, "num_range": 2794613539128204101, "upper_bound": "294276-12-31 23:59:59.999999+00:00"}], "histo_col_type": "TIMESTAMPTZ", "name": "__auto__", "null_count": 0, "row_count": 6307107145233804882}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6129907188440254449, "histo_buckets": [{"distinct_range": 0, "num_eq": 4407128210589478896, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 1387479477797983000, "num_eq": 40, "num_range": 5249229595305659304, "upper_bound": "802806191"}, {"distinct_range": 7369041900102836000, "num_eq": 1230211772798857475, "num_range": 8225868796782344173, "upper_bound": "1484141885"}, {"distinct_range": 0, "num_eq": 6370892954674944561, "num_range": 5004374408076458777, "upper_bound": "1625201797"}, {"distinct_range": 4807350910243771000, "num_eq": 0, "num_range": 6421686801547876177, "upper_bound": "2193999989"}, {"distinct_range": 4573470097535621000, "num_eq": 80, "num_range": 4660737234994261049, "upper_bound": "2237207238"}, {"distinct_range": 3348383002517544000, "num_eq": 2000000, "num_range": 3562615383201784693, "upper_bound": "2740257506"}, {"distinct_range": 3546474856554472400, "num_eq": 0, "num_range": 3546474856554472436, "upper_bound": "3727501408"}], "histo_col_type": "REGPROC", "name": "__auto__", "null_count": 0, "row_count": 6307107145233804882}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4641291479744386154, "histo_buckets": [{"distinct_range": 0, "num_eq": 2124761240080895266, "num_range": 0, "upper_bound": "\\u000cW2\\\\\\u000en"}, {"distinct_range": 0, "num_eq": 1000, "num_range": 2168766526147798115, "upper_bound": "\\u0018\\u001c\\u0008R}\\u00029{r"}, {"distinct_range": 864214472698799600, "num_eq": 20000000, "num_range": 864214472698799575, "upper_bound": "\'"}, {"distinct_range": 7984339831283226000, "num_eq": 805026829894475128, "num_range": 7984339831283225507, "upper_bound": "+\\r"}, {"distinct_range": 0, "num_eq": 5000, "num_range": 7095559629745841223, "upper_bound": "AN{vC\\u0015?\\u0019"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 6307107145233804882}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1927494705347326247, "histo_buckets": [{"distinct_range": 0, "num_eq": 4291800223366900683, "num_range": 0, "upper_bound": "41893928"}, {"distinct_range": 0, "num_eq": 100000000, "num_range": 10000000, "upper_bound": "276354750"}, {"distinct_range": 40000000000, "num_eq": 30000000, "num_range": 40000000000, "upper_bound": "845990672"}, {"distinct_range": 4221450895681879000, "num_eq": 400000, "num_range": 4221450895681879041, "upper_bound": "1465260367"}, {"distinct_range": 1257573009275578400, "num_eq": 900, "num_range": 1257573009275578284, "upper_bound": "1620570172"}, {"distinct_range": 3719690656304580600, "num_eq": 100, "num_range": 8250393497225132198, "upper_bound": "2916904588"}, {"distinct_range": 0, "num_eq": 60, "num_range": 9105020107235311625, "upper_bound": "3695503105"}, {"distinct_range": 0, "num_eq": 100000000, "num_range": 439126332925938872, "upper_bound": "4063218268"}, {"distinct_range": 0, "num_eq": 5440611578708067753, "num_range": 3301230128180075162, "upper_bound": "4116363826"}], "histo_col_type": "REGPROC", "name": "__auto__", "null_count": 0, "row_count": 6307107145233804882}, {"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1262671800685592645, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6307107145233804882}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3713792591643851794, "histo_buckets": [{"distinct_range": 0, "num_eq": 3975159839752548689, "num_range": 0, "upper_bound": "109653122"}, {"distinct_range": 0, "num_eq": 0, "num_range": 900000000, "upper_bound": "534262473"}, {"distinct_range": 3.8320323347502767, "num_eq": 8035713568796375303, "num_range": 30, "upper_bound": "1225797400"}, {"distinct_range": 0, "num_eq": 1000, "num_range": 7000, "upper_bound": "2120892322"}, {"distinct_range": 2130499130920685600, "num_eq": 3660850227495722180, "num_range": 2130499130920685668, "upper_bound": "3684107853"}], "histo_col_type": "REGPROCEDURE", "name": "__auto__", "null_count": 0, "row_count": 6307107145233804882}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('ewpy', 'hryf', 'igohl', 'ptbx', 'jejoaa');
        CREATE TYPE rand_typ_1 AS ENUM ('rqy', 'yrec', 'um');
        CREATE TYPE rand_typ_2 AS ENUM ('wbw');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith2626854935
--- FAIL: TestRandomSyntaxSQLSmith (300.91s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 71becf337d9d2731298dc092f3ce9cf0f0eedb2c:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: expected *DJSON, found tree.dNull

Query:

        SELECT
        	tab_167331.col2_0 AS col_383097,
        	crdb_internal.merge_statement_stats((NULL::JSONB || NULL::JSONB[])::JSONB[]::JSONB[])::JSONB AS col_383098,
        	tab_167332.tableoid AS col_383099
        FROM
        	defaultdb.public.table2@[0] AS tab_167331, defaultdb.public.table1@[0] AS tab_167332
        ORDER BY
        	tab_167332.crdb_internal_mvcc_timestamp DESC,
        	tab_167332.crdb_internal_mvcc_timestamp,
        	tab_167332.col1_2,
        	tab_167332.col1_0 DESC
        LIMIT
        	35:::INT8;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 REGPROCEDURE NOT NULL, col1_1 TIMESTAMPTZ NULL, col1_2 REGPROC NULL, col1_3 VARCHAR NOT NULL, col1_4 TIMESTAMP, col1_5 JSONB NOT NULL, col1_6 INTERVAL NOT NULL, col1_7 DECIMAL, col1_8 TIMESTAMPTZ, col1_9 NAME NULL, col1_10 INT4 NULL, col1_11 DATE, col1_12 GEOMETRY NOT NULL);
        CREATE TABLE table2 (col2_0 CHAR NOT NULL, col2_1 VARCHAR NOT NULL, PRIMARY KEY (col2_1, col2_0 ASC), INDEX (lower(col2_1) DESC) WHERE (table2.col2_0 < 'X':::STRING) AND (table2.col2_1 <= '"':::STRING), INDEX (col2_1 ASC, col2_0 DESC), UNIQUE (col2_0, col2_1) WHERE table2.col2_0 >= 'X':::STRING, INDEX (col2_1, col2_0 DESC), UNIQUE (col2_1 DESC, col2_0 DESC) WHERE (table2.col2_0 > e'\U00002603':::STRING) AND (table2.col2_1 > e'\x00':::STRING), UNIQUE (col2_1 DESC, col2_0 DESC) WHERE (table2.col2_1 <= e'\'':::STRING) AND (table2.col2_0 >= '':::STRING), FAMILY (col2_1, col2_0));
        CREATE TABLE table3 (col3_0 BYTES NULL, col3_1 REGPROCEDURE NULL, col3_2 FLOAT4 NOT NULL, col3_3 TIMESTAMPTZ NOT NULL, col3_4 NAME NOT NULL, col3_5 INT4 NOT NULL, col3_6 BYTES NOT NULL, col3_7 "char" NOT NULL, col3_8 OID NOT NULL, col3_9 REGPROCEDURE NOT NULL, col3_10 CHAR NULL, col3_11 INT8 NOT NULL, col3_12 STRING NOT NULL AS (CASE WHEN col3_6 IS NULL THEN 'x6':::STRING ELSE '':::STRING END) VIRTUAL, col3_13 FLOAT4 NOT NULL AS (col3_2 + '-Inf':::FLOAT8) VIRTUAL, col3_14 INT4 NOT NULL AS (col3_5 + col3_11) STORED, col3_15 INT8 NOT NULL AS (col3_11 + col3_5) STORED, col3_16 STRING NOT NULL AS (CASE WHEN col3_6 IS NULL THEN e';JwGFS\x7f>':::STRING ELSE NULL END) STORED, col3_17 STRING AS (lower(col3_7)) STORED, PRIMARY KEY (col3_15, col3_5 DESC, col3_8, col3_7 DESC, col3_4, col3_9 DESC, col3_2, col3_16 ASC, col3_11, col3_12, col3_3, col3_13 DESC, col3_14, col3_6 ASC), UNIQUE (col3_14 ASC, col3_1 DESC, col3_0 DESC, (col3_5 + (-1572748075):::INT8) DESC, col3_2 DESC, col3_4 DESC, col3_8 ASC, col3_12 ASC, col3_5 DESC, col3_10 ASC, col3_15 ASC) WHERE (((((((table3.col3_6 < '\xff':::BYTES) OR (table3.col3_16 >= e'\'':::STRING)) AND (table3.col3_13 > 3.4028234663852886e+38:::FLOAT8)) AND (table3.col3_10 > '':::STRING)) AND (table3.col3_4 <= 'X':::STRING)) OR (table3.col3_0 != '\xe29883':::BYTES)) OR (table3.col3_3 >= '294276-12-31 23:59:59.999999+00:00':::TIMESTAMPTZ)) OR (table3.col3_15 <= 32767:::INT8), UNIQUE (col3_6) STORING (col3_0, col3_10) WHERE (((((((((table3.col3_0 >= '\xff':::BYTES) AND (table3.col3_15 <= (-128):::INT8)) AND (table3.col3_3 > '0001-01-01 00:00:00+00:00':::TIMESTAMPTZ)) OR (table3.col3_4 = 'X':::STRING)) OR (table3.col3_12 != '':::STRING)) AND (table3.col3_2 >= 1.0:::FLOAT8)) OR (table3.col3_10 < e'\x00':::STRING)) OR (table3.col3_7 = '':::STRING)) OR (table3.col3_17 <= 'X':::STRING)) AND (table3.col3_16 >= 'X':::STRING), INDEX (col3_16 DESC, col3_0 ASC, col3_14 DESC, col3_10 DESC, col3_1 ASC, col3_2 ASC, col3_8, col3_6, col3_9 ASC, col3_11 DESC, col3_17 ASC) WHERE (((((((((((((table3.col3_5 <= 1:::INT8) OR (table3.col3_17 = '"':::STRING)) AND (table3.col3_14 = (-128):::INT8)) AND (table3.col3_11 != 0:::INT8)) OR (table3.col3_7 != e'\U00002603':::STRING)) AND (table3.col3_0 != '\x22':::BYTES)) AND (table3.col3_13 = 1.401298464324817e-45:::FLOAT8)) OR (table3.col3_4 != 'X':::STRING)) AND (table3.col3_10 >= 'X':::STRING)) AND (table3.col3_12 <= '':::STRING)) OR (table3.col3_15 != 9223372036854775807:::INT8)) OR (table3.col3_16 >= e'\U00002603':::STRING)) AND (table3.col3_2 != 3.4028234663852886e+38:::FLOAT8)) AND (table3.col3_3 > '-2000-01-01 00:00:00+00:00':::TIMESTAMPTZ));
        ALTER TABLE table1 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 737082204, "histo_col_type": "", "name": "__auto__", "null_count": 645247395, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 210534157, "histo_col_type": "", "name": "__auto__", "null_count": 280468834, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 642836073, "histo_col_type": "", "name": "__auto__", "null_count": 605241131, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 84421883, "histo_col_type": "", "name": "__auto__", "null_count": 624717232, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 119971655, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 272622086, "histo_col_type": "", "name": "__auto__", "null_count": 206392862, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 175035516, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 449397929, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 374188979, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 587163531, "histo_col_type": "", "name": "__auto__", "null_count": 378576460, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 134225957, "histo_col_type": "", "name": "__auto__", "null_count": 305386286, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 509698111, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 800000000}, {"avg_size": 0, "columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 379102432, "histo_col_type": "", "name": "__auto__", "null_count": 204398885, "row_count": 800000000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4082914426257524824, "histo_buckets": [{"distinct_range": 0, "num_eq": 6618020108226413538, "num_range": 0, "upper_bound": ""}, {"distinct_range": 0, "num_eq": 70, "num_range": 2174779053135535342, "upper_bound": "\\n"}, {"distinct_range": 775727479288296600, "num_eq": 1841293060983304606, "num_range": 1756560006639641488, "upper_bound": "<"}, {"distinct_range": 3001704964457158000, "num_eq": 3547696300520401845, "num_range": 5772484935747786745, "upper_bound": "N"}, {"distinct_range": 58.40480971978169, "num_eq": 70, "num_range": 90, "upper_bound": "X"}, {"distinct_range": 31710529.37243922, "num_eq": 600, "num_range": 80000000, "upper_bound": "\\\\"}, {"distinct_range": 0, "num_eq": 100000, "num_range": 4537478094016268725, "upper_bound": "^"}, {"distinct_range": 7097417017825391000, "num_eq": 800000, "num_range": 7097417017825390585, "upper_bound": "|"}], "histo_col_type": "CHAR", "name": "__auto__", "null_count": 0, "row_count": 4833267810058661861}, {"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3687673547546005649, "histo_buckets": [{"distinct_range": 0, "num_eq": 7000000, "num_range": 0, "upper_bound": "RI($t0\\r\\u000b"}, {"distinct_range": 6921271228863412000, "num_eq": 90000, "num_range": 6921271228863412553, "upper_bound": "T"}, {"distinct_range": 800, "num_eq": 6530182920036588086, "num_range": 800, "upper_bound": "e\x7f%AC"}], "histo_col_type": "VARCHAR", "name": "__auto__", "null_count": 0, "row_count": 4833267810058661861}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2285226775622033077, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2172246256349102919, "histo_col_type": "", "name": "__auto__", "null_count": 3997783944764680660, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1250223687974051212, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4939464541314807923, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 480319126067230946, "histo_col_type": "", "name": "__auto__", "null_count": 878303582107565642, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3838188201380463239, "histo_col_type": "", "name": "__auto__", "null_count": 3806014579377517663, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 287467272207086209, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3293138896580037368, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2610422929054604631, "histo_buckets": [{"distinct_range": 0, "num_eq": 4129390364290762654, "num_range": 0, "upper_bound": "-2125719862585967686"}, {"distinct_range": 0, "num_eq": 400000, "num_range": 2301032105931818193, "upper_bound": "3644862132545157010"}, {"distinct_range": 0, "num_eq": 0, "num_range": 7000000000, "upper_bound": "5983022241130084191"}, {"distinct_range": 500000000, "num_eq": 829138142563424679, "num_range": 500000000, "upper_bound": "8351561358665387395"}], "histo_col_type": "INT8", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4585686809931584574, "histo_buckets": [{"distinct_range": 0, "num_eq": 5000000, "num_range": 0, "upper_bound": "B)"}, {"distinct_range": 6271706019606452000, "num_eq": 0, "num_range": 6271706019606452729, "upper_bound": "PH\\tb \\u00179``"}, {"distinct_range": 0, "num_eq": 2468110249208504882, "num_range": 1117844750045312410, "upper_bound": "ivK"}, {"distinct_range": 1555828547420070100, "num_eq": 5946419805595504248, "num_range": 5023160756991805420, "upper_bound": "~b``"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4305775468618626993, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4806413582264421493, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1529211937023026495, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3508789800044986024, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3207560081920394325, "histo_col_type": "", "name": "__auto__", "null_count": 5379777161906272822, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3178019657597544422, "histo_buckets": [{"distinct_range": 0, "num_eq": 5321776583088482864, "num_range": 0, "upper_bound": "\\\\x"}, {"distinct_range": 0, "num_eq": 2075650080818861356, "num_range": 80, "upper_bound": "\\\\x085ec6739f"}, {"distinct_range": 0, "num_eq": 686020345501285435, "num_range": 800000000, "upper_bound": "\\\\x71"}, {"distinct_range": 0, "num_eq": 500, "num_range": 1192921655832563745, "upper_bound": "\\\\xf160e6"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4371995667551361613, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}, {"avg_size": 0, "columns": ["col3_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2061019289351366635, "histo_buckets": [{"distinct_range": 0, "num_eq": 600000000, "num_range": 0, "upper_bound": "-2061851085"}, {"distinct_range": 0, "num_eq": 3011011040837589696, "num_range": 0, "upper_bound": "-1961425486"}, {"distinct_range": 0, "num_eq": 6000, "num_range": 90000000, "upper_bound": "-1011898932"}, {"distinct_range": 20, "num_eq": 168198451653992558, "num_range": 20, "upper_bound": "-345040714"}, {"distinct_range": 0, "num_eq": 70000000000, "num_range": 9000, "upper_bound": "731695402"}], "histo_col_type": "INT4", "name": "__auto__", "null_count": 0, "row_count": 5767288915260324866}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('uwzqee', 'pjm', 'eor', 'a', 'gtpbz');
        CREATE TYPE rand_typ_1 AS ENUM ('tvs', 'qif');
        CREATE TYPE rand_typ_2 AS ENUM ('tri', 'gm', 'kwgelr', 'ylbsee');
        CREATE TYPE rand_typ_3 AS ENUM ('pbp', 'wf', 'ogbp', 'f', 'k', 'lbjsw');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith1865928650
--- FAIL: TestRandomSyntaxSQLSmith (300.87s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ bb85ddc4fc0ad8761d7aba61315da22b433022e3:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: expected *DJSON, found tree.dNull

Query:

        WITH
        	with_27331 (col_164059, col_164060, col_164061, col_164062)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							NULL,
        							right('\x74130bdd':::BYTES::BYTES, (-554994171026975279):::INT8::INT8)::BYTES,
        							e'qTNe{zV\x15':::STRING:::NAME,
        							(
        								WITH
        									with_27330 (col_164057)
        										AS (
        											SELECT
        												*
        											FROM
        												(
        													VALUES
        														(
        															ARRAY[308076962:::OID,4125541361:::OID,3785763477:::OID,4279548746:::OID,3760719087:::OID,701272385:::OID]
        														),
        														(ARRAY[0:::OID,2557496823:::OID,456769639:::OID]),
        														(ARRAY[]:::OID[]),
        														(NULL),
        														(ARRAY[2613939824:::OID])
        												)
        													AS tab_66894 (col_164057)
        										)
        								SELECT
        									'1988-04-20':::DATE AS col_164058
        								FROM
        									with_27330 AS cte_ref_7912
        								WHERE
        									true
        								ORDER BY
        									cte_ref_7912.col_164057, cte_ref_7912.col_164057 ASC
        								LIMIT
        									1:::INT8
        							)
        						),
        						(
        							NULL,
        							(NULL::BYTES || '\xa1e2fb3ea5974f14d9':::BYTES::BYTES)::BYTES,
        							NULL,
        							'1976-10-31':::DATE
        						),
        						(
        							'[[[false, [{"a": [], "foobar": {"foo": [[]]}}, {}], {}], {}], false, 0.03974190959514552]':::JSONB,
        							'\xd3':::BYTES,
        							e'\t&W\x7f\tSgQ':::STRING:::NAME,
        							((-411998652436503962):::INT8::INT8 + NULL::DATE)::DATE
        						),
        						(
        							e'{"!hYkN[C2S8b": [], "X\'40}s": {"b": {"O=0V": {}}}, "c4?%JkR0UMd": {"5j,Sk": [], "GK8LEfKyT": {}, "c": true, "foobar": false, "y@\\"*``nh{x0": null}, "fJpV|b{v": [], "g{aBPhZ7j": {".xZ}": {"baz": []}, "?F0Aa7Ru[;": [[]]}}':::JSONB,
        							'\x':::BYTES,
        							e'\rxlcF[3?o':::STRING:::NAME,
        							'1976-08-11':::DATE
        						),
        						(
        							crdb_internal.merge_statement_stats(((e'[[[[{"INb+ob1{U!": {}, "K$3\\\\L": "foo", "b": {"c": []}}], {"onvs8": true}, {"b": [], "baz": [], "o8{MS": [true]}], []], []]':::JSONB::JSONB || ARRAY['{" (].*": [{"-2ZOu3": [], "[^9": false, "fYy%JF": []}, {}, {"a": true}, [], true], "foobar": true, "zqyM(UDaH": [[{"a": null, "baz": null}, true]]}':::JSONB,'true':::JSONB,e'{"bar": [[false]], "c": {"<}m#": {"79g2<Jy2\\\\": {}, "baz": false, "xB.!QXTz": []}, "rte >N": {"\\"Q^M!rpirR\'": {"$6+-tcLh~V,": ["a"], "}i>VtsgJ3sq": [[{}, {"a": {"bar": 0.43605928426479257}}]]}}}}':::JSONB]::JSONB[])::JSONB[]::JSONB[] || NULL::JSONB)::JSONB[]::JSONB[])::JSONB,
        							'\x73a3b87aac85b1b1b3':::BYTES,
        							e'O\x0bVV 1':::STRING:::NAME,
        							'1991-12-17':::DATE
        						)
        				)
        					AS tab_66895 (col_164059, col_164060, col_164061, col_164062)
        		),
        	with_27332 (col_164063)
        		AS (
        			SELECT
        				*
        			FROM
        				(VALUES ('':::VOID), ('':::VOID), ('':::VOID), ('':::VOID), (NULL), ('':::VOID))
        					AS tab_66896 (col_164063)
        		),
        	with_27333 (col_164065)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							(
        								SELECT
        									'1980-11-28':::DATE AS col_164064
        								FROM
        									defaultdb.public.table3@[0] AS tab_66897
        								ORDER BY
        									tab_66897.col3_7 ASC, tab_66897.col3_10 DESC, tab_66897.col3_1 ASC
        								LIMIT
        									1:::INT8
        							)
        						),
        						('1987-06-12':::DATE),
        						('1991-02-27':::DATE),
        						('1978-11-23':::DATE),

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 JSONB NOT NULL, col1_1 GEOMETRY NOT NULL, col1_2 TIMESTAMPTZ, col1_3 DATE, col1_4 TIMESTAMP, col1_5 INTERVAL NOT NULL, col1_6 INT2 NOT NULL, col1_7 FLOAT8 NOT NULL, col1_8 UUID NULL, col1_9 REGPROCEDURE NULL, col1_10 "char", col1_11 DATE NOT NULL, col1_12 "char" NOT NULL, col1_13 INET, col1_14 DECIMAL NULL, col1_15 REGTYPE, col1_16 STRING AS (CASE WHEN col1_15 IS NULL THEN e'\x16Ai&m':::STRING ELSE NULL END) STORED, INDEX (col1_7 ASC) WHERE (((((((((table1.col1_14 >= '-Infinity':::DECIMAL) AND (table1.col1_4 < '-2000-01-01 00:00:00':::TIMESTAMP)) OR (table1.col1_12 < '':::STRING)) AND (table1.col1_2 != '0001-01-01 00:00:00+00:00':::TIMESTAMPTZ)) AND (table1.col1_7 <= 1.7976931348623157e+308:::FLOAT8)) AND (table1.col1_3 > '-infinity':::DATE)) OR (table1.col1_6 != 1:::INT8)) OR (table1.col1_16 <= '"':::STRING)) OR (table1.col1_10 > e'\'':::STRING)) AND (table1.col1_11 <= '5874897-12-31':::DATE), INVERTED INDEX (col1_16 DESC, col1_14, col1_3, (CASE WHEN col1_15 IS NULL THEN e'1Q3$\x10/':::STRING ELSE e'CP\x0b':::STRING END) ASC, col1_9, col1_11, col1_8 DESC, col1_5 DESC, col1_15 DESC, col1_0), UNIQUE (col1_10, col1_6));
        CREATE TABLE table2 (col2_0 INT8 NULL, col2_1 BYTES NOT NULL, col2_2 NAME NOT NULL, col2_3 INT4 NULL, col2_4 TIMESTAMPTZ NOT NULL, col2_5 VARCHAR, col2_6 OID[] NULL, col2_7 GEOMETRY, col2_8 REGPROCEDURE NULL, col2_9 TIME, col2_10 STRING NULL, col2_11 FLOAT4 NULL, col2_12 "char", col2_13 REGNAMESPACE NOT NULL, col2_14 TIMESTAMP NULL, col2_15 TIMESTAMP, col2_16 INT8 NOT NULL AS (col2_0 + col2_3) STORED, col2_17 STRING NOT NULL AS (CASE WHEN col2_1 IS NULL THEN e'\x00':::STRING ELSE '':::STRING END) VIRTUAL, PRIMARY KEY (col2_17, col2_16 ASC), INVERTED INDEX (col2_13 DESC, col2_10 DESC, col2_6 DESC) WHERE (((((((((((((table2.col2_11 = '+Inf':::FLOAT8) AND (table2.col2_17 > '"':::STRING)) OR (table2.col2_12 = e'\x00':::STRING)) AND (table2.col2_9 < '24:00:00':::TIME)) AND (table2.col2_2 > 'X':::STRING)) OR (table2.col2_0 <= 127:::INT8)) AND (table2.col2_5 > 'X':::STRING)) OR (table2.col2_14 >= '-4713-11-24 00:00:00':::TIMESTAMP)) AND (table2.col2_3 < (-32768):::INT8)) AND (table2.col2_1 = '\xe29883':::BYTES)) AND (table2.col2_15 != '-4713-11-24 00:00:00':::TIMESTAMP)) OR (table2.col2_10 = e'\x00':::STRING)) AND (table2.col2_16 < (-2147483648):::INT8)) AND (table2.col2_4 > '294276-12-31 23:59:59.999999+00:00':::TIMESTAMPTZ));
        CREATE TABLE table3 (col3_0 REGTYPE NOT NULL, col3_1 NAME NOT NULL, col3_2 UUID NOT NULL, col3_3 BYTES NOT NULL, col3_4 INTERVAL NOT NULL, col3_5 BOOL NOT NULL, col3_6 INTERVAL, col3_7 REGCLASS, col3_8 CHAR[] NULL, col3_9 BIT(3), col3_10 INET NULL, col3_11 STRING NULL AS (lower(CAST(col3_5 AS STRING))) STORED, col3_12 STRING NOT NULL AS (CASE WHEN col3_0 IS NULL THEN 'n?%?':::STRING ELSE '3G6':::STRING END) STORED, col3_13 STRING NOT NULL AS (CASE WHEN col3_8 IS NULL THEN e'O\x03\x17GG__\x1cu':::STRING ELSE 'LLhp~':::STRING END) STORED, col3_14 STRING NOT NULL AS (lower(col3_1)) STORED, col3_15 STRING NOT NULL AS (lower(col3_1)) STORED, PRIMARY KEY (col3_13 DESC, col3_4, col3_0 ASC, col3_3 ASC, col3_14, col3_12 DESC, col3_5, col3_15 ASC), UNIQUE (lower(CAST(col3_10 AS STRING)) DESC, col3_12 ASC, col3_13 DESC, col3_11 DESC, col3_1 ASC, col3_10 DESC, col3_9 DESC, col3_4 ASC) STORING (col3_2) WHERE (((((((table3.col3_12 <= e'\U00002603':::STRING) AND (table3.col3_11 = '':::STRING)) AND (table3.col3_3 = '\x00':::BYTES)) OR (table3.col3_1 < e'\x00':::STRING)) OR (NOT table3.col3_5)) AND (table3.col3_13 >= e'\x00':::STRING)) AND (table3.col3_14 <= '"':::STRING)) AND (table3.col3_15 != e'\x00':::STRING), INDEX (col3_11 ASC, col3_2, col3_12, (CASE WHEN col3_6 IS NULL THEN e'\x1cgrE\x16t8':::STRING ELSE 'I&# ^@W]':::STRING END), col3_5 ASC, col3_10 ASC, col3_9 ASC, col3_4 ASC, col3_6, col3_0 ASC) STORING (col3_7, col3_8), UNIQUE (col3_9 DESC, col3_7, col3_14, col3_0 ASC, col3_13, col3_2 ASC, col3_15, col3_11 ASC, col3_10), INDEX (col3_2, col3_10, col3_1 DESC) WHERE (table3.col3_5 AND (table3.col3_14 <= e'\'':::STRING)) OR (table3.col3_11 >= 'X':::STRING), INVERTED INDEX (col3_2 ASC, col3_1, col3_12 DESC, col3_4 ASC, col3_11 DESC, col3_10, col3_13 DESC, (CASE WHEN col3_7 IS NULL THEN e'\x16\'z':::STRING ELSE '':::STRING END) ASC, col3_0 ASC, col3_15 ASC, col3_7 DESC, col3_14 DESC, col3_8 DESC), UNIQUE (col3_2, col3_1) STORING (col3_6, col3_9, col3_10, col3_11), INDEX (col3_13 DESC, col3_14 DESC, col3_5, (CASE WHEN col3_7 IS NULL THEN e'*\x12':::STRING ELSE e'|\x7f\x17/.b':::STRING END), col3_2, col3_3 DESC, col3_10 DESC, col3_11, col3_6 DESC) STORING (col3_1, col3_8) WHERE ((((((table3.col3_11 < e'\U00002603':::STRING) OR (table3.col3_13 <= '"':::STRING)) OR (table3.col3_12 != '':::STRING)) AND (table3.col3_15 < '':::STRING)) OR (table3.col3_1 >= '"':::STRING)) OR table3.col3_5) AND (table3.col3_3 < '\x00':::BYTES), FAMILY (col3_6, col3_15, col3_3), FAMILY (col3_14), FAMILY (col3_9, col3_4), FAMILY (col3_10, col3_12, col3_1, col3_11, col3_0, col3_7), FAMILY (col3_8), FAMILY (col3_5), FAMILY (col3_2), FAMILY (col3_13));
        ALTER TABLE table1 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 33, "histo_col_type": "", "name": "__auto__", "null_count": 427, "row_count": 700}, {"avg_size": 0, "columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 508, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 700}, {"avg_size": 0, "columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 411, "histo_col_type": "", "name": "__auto__", "null_count": 344, "row_count": 700}, {"avg_size": 0, "columns": ["col1_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 166, "histo_col_type": "", "name": "__auto__", "null_count": 198, "row_count": 700}, {"avg_size": 0, "columns": ["col1_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 501, "histo_col_type": "", "name": "__auto__", "null_count": 103, "row_count": 700}, {"avg_size": 0, "columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 688, "histo_col_type": "", "name": "__auto__", "null_count": 447, "row_count": 700}, {"avg_size": 0, "columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 174, "histo_col_type": "", "name": "__auto__", "null_count": 292, "row_count": 700}, {"avg_size": 0, "columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 92, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 700}, {"avg_size": 0, "columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 636, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 700}, {"avg_size": 0, "columns": ["col1_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 333, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 700}, {"avg_size": 0, "columns": ["col1_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 616, "histo_buckets": [{"distinct_range": 0, "num_eq": 2000000000, "num_range": 0, "upper_bound": ""}, {"distinct_range": 8014389625548741000, "num_eq": 3402406389712335186, "num_range": 8014389625548740763, "upper_bound": "\\u0000"}, {"distinct_range": 0, "num_eq": 983165542522995780, "num_range": 6000, "upper_bound": "R\\u0015\\u00070l\\u0014:"}, {"distinct_range": 0, "num_eq": 90000000000, "num_range": 3407013366793145872, "upper_bound": "l!3"}, {"distinct_range": 0, "num_eq": 2664542149371023857, "num_range": 0, "upper_bound": "q*C"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 163, "row_count": 700}, {"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 681, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 700}, {"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 244, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 700}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 310, "histo_col_type": "", "name": "__auto__", "null_count": 445, "row_count": 700}, {"avg_size": 0, "columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 471, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 700}, {"avg_size": 0, "columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 253, "histo_col_type": "", "name": "__auto__", "null_count": 532, "row_count": 700}, {"avg_size": 0, "columns": ["col1_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 405, "histo_col_type": "", "name": "__auto__", "null_count": 365, "row_count": 700}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 37120233338, "histo_col_type": "", "name": "__auto__", "null_count": 2464948478, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 33156370535, "histo_col_type": "", "name": "__auto__", "null_count": 57919538769, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2391269850, "histo_col_type": "", "name": "__auto__", "null_count": 42566815434, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 23876685201, "histo_col_type": "", "name": "__auto__", "null_count": 2251727222, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 64690743224, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 46320658853, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 24185318053, "histo_col_type": "", "name": "__auto__", "null_count": 62589250387, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 53104283406, "histo_col_type": "", "name": "__auto__", "null_count": 48538331645, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8459703080, "histo_buckets": [{"distinct_range": 0, "num_eq": 7000, "num_range": 0, "upper_bound": "X"}, {"distinct_range": 0, "num_eq": 20000000000, "num_range": 6290325112397401797, "upper_bound": "ww\\u00058"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 55957583768, "histo_col_type": "", "name": "__auto__", "null_count": 68658315462, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 11849173071, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 13649343431, "histo_col_type": "", "name": "__auto__", "null_count": 27782375904, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 36638676370, "histo_col_type": "", "name": "__auto__", "null_count": 48779593018, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 60927279162, "histo_col_type": "", "name": "__auto__", "null_count": 30374081590, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 61481780503, "histo_col_type": "", "name": "__auto__", "null_count": 62433150986, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 66907963100, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 30168852778, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"avg_size": 0, "columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 56683986239, "histo_col_type": "", "name": "__auto__", "null_count": 42423942111, "row_count": 70000000000}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5388212241852215364, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1982243962072363511, "histo_buckets": [{"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "011"}, {"distinct_range": 10000000000, "num_eq": 1687017182898353283, "num_range": 10000000000, "upper_bound": "100"}], "histo_col_type": "BIT(3)", "name": "__auto__", "null_count": 4358843026674499986, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5686107793712811582, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1252562860464693933, "histo_buckets": [{"distinct_range": 0, "num_eq": 116519225429297381, "num_range": 0, "upper_bound": ""}, {"distinct_range": 300, "num_eq": 3002807104631866422, "num_range": 300, "upper_bound": "H\\"<)h75"}, {"distinct_range": 0, "num_eq": 8087310743676217357, "num_range": 400000, "upper_bound": "V\\u000fS\\u00103n"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5606011621904009645, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 219107663442709026, "histo_col_type": "", "name": "__auto__", "null_count": 3700079441870353103, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3787647097442500380, "histo_col_type": "", "name": "__auto__", "null_count": 6699979923772330664, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6702672802311635834, "histo_col_type": "", "name": "__auto__", "null_count": 4774604055860395077, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5097282237643219362, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5999798190332001944, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6892260090133880454, "histo_buckets": [{"distinct_range": 0, "num_eq": 800000000, "num_range": 0, "upper_bound": "5247d298-d14d-4bfe-af36-0e3760216ecd"}, {"distinct_range": 50, "num_eq": 5000000000, "num_range": 50, "upper_bound": "6df2736b-5dc6-44c0-bb41-8e6d0b7d3b20"}, {"distinct_range": 0, "num_eq": 10000, "num_range": 8000903449052538985, "upper_bound": "7832d085-5100-4121-8472-cedc8a800a11"}, {"distinct_range": 100000000, "num_eq": 200000, "num_range": 100000000, "upper_bound": "af9b9bbc-1aeb-4442-9727-ad8e2d0782b9"}, {"distinct_range": 74.44299486067322, "num_eq": 1068806500409759406, "num_range": 500, "upper_bound": "cafb6b6e-1ac1-40ee-9f42-1fd626c76e95"}, {"distinct_range": 0, "num_eq": 8736332313080010569, "num_range": 4989122134710056140, "upper_bound": "ff7139e4-338d-4d49-be09-955e6c9baa97"}], "histo_col_type": "UUID", "name": "__auto__", "null_count": 0, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3148450593058690131, "histo_col_type": "", "name": "__auto__", "null_count": 6122162648304019609, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6136873054600557317, "histo_col_type": "", "name": "__auto__", "null_count": 769460455055821351, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2468708344723775202, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3957021520035314528, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6898170675533415368}, {"avg_size": 0, "columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 60670345971880765, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6898170675533415368}]':::JSONB;
        ALTER TABLE table2 ADD FOREIGN KEY (col2_12, col2_3) REFERENCES table1 (col1_10, col1_6) ON DELETE CASCADE;
        CREATE TYPE rand_typ_0 AS ENUM ('byhaia', 'o', 'roesz');
        CREATE TYPE rand_typ_1 AS ENUM ('jm', 'igctg');
        CREATE TYPE rand_typ_2 AS ENUM ('anzby', 'eovv', 'oabpw', 'a', 'gm', 'tkapps');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith2738148495
--- FAIL: TestRandomSyntaxSQLSmith (329.00s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ a5158c4c93e9dca858b38ef7e94321f0a0a2b5c5:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: expected *DJSON, found tree.dNull

Query:

        WITH
        	with_177215 (col_1019345)
        		AS (
        			SELECT
        				*
        			FROM
        				(VALUES ('1974-12-29':::DATE), ('1974-06-18':::DATE), ('1979-05-05':::DATE), ('1993-04-03':::DATE))
        					AS tab_431884 (col_1019345)
        			EXCEPT
        				SELECT
        					*
        				FROM
        					(
        						VALUES
        							('1970-01-01':::DATE),
        							(localtimestamp():::DATE::DATE),
        							('1994-10-03':::DATE),
        							('1970-08-12':::DATE),
        							(NULL)
        					)
        						AS tab_431885 (col_1019346)
        		),
        	with_177216 (col_1019347)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							e'{"b": "c", "c": {"a": [{"G<\\\\RU": {}}, [[]], null], "c": {"b": true, "c|cCQ": null}, "foo": null, "foobar": []}}':::JSONB
        						),
        						(
        							(e'{"Jh@N(tQ)Z[": {"bar": {}, "rV9$gR": 1.0063325530563645}, "N~w\'^<o_[GU~": {"eU0t": [{"CAWfA@Vsa``": 0.45835838540284524}], "foo": {"8S2x-L": []}}, "\\\\&)@04": {"b": null}, "foo": {"BKm": [{"Z&*": {}, "foobar": []}, []]}}':::JSONB::JSONB->3969115549360976181:::INT8::INT8)::JSONB
        						)
        				)
        					AS tab_431886 (col_1019347)
        			EXCEPT
        				SELECT
        					*
        				FROM
        					(
        						VALUES
        							(
        								e'{"*\'u$Bq2<": {")9Gbm]2u": true, "P\\\\t03fm[aw}": 0.12473483041481231, "foo": null, "k>QP3&KV!^": [], "orJuJ@hn+s@": {}}, "Bd ji0k": null, "foobar": {"46b[t": [[]], "foo": [[]]}}':::JSONB
        							),
        							(
        								'{"Vx&fSag=": null, "W~{?Gy": false, "Z)QH)": [], "b5!s^t|": 0.5486069243897493, "bar": {":@P": [], "c": {}, "{s:ukW@h": {"foo": [{}, []]}}}':::JSONB
        							),
        							(
        								'{"baz": false, "lRD0&:JQ}}q*": {"a": true, "foobar": [{"KaE/H$&$P~": 0.6505401694492481}, [{"/g_w-RKd4M": 1.474161112548571}]]}}':::JSONB
        							),
        							('true':::JSONB),
        							(
        								crdb_internal.merge_statement_stats((ARRAY['[[false, 0.49882551687025745, [[true, 0.554734681463916], 2.2161042260496986, true], []], [{"bar": {"baz": [[]]}, "foobar": []}], {}]':::JSONB]::JSONB[] || NULL::JSONB)::JSONB[]::JSONB[])::JSONB
        							),
        							('{"I[>N@qb*f": "bar"}':::JSONB)
        					)
        						AS tab_431887 (col_1019348)
        		)
        SELECT
        	tab_431888.col2_5 AS col_1019349
        FROM
        	defaultdb.public.table2@table2_col2_10_key AS tab_431888, with_177216 AS cte_ref_51518
        WHERE
        	false
        ORDER BY
        	tab_431888.tableoid ASC,
        	tab_431888.col2_10 ASC,
        	tab_431888.col2_12,
        	tab_431888.col2_11 DESC,
        	tab_431888.col2_10 ASC,
        	tab_431888.col2_2
        LIMIT
        	70:::INT8;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 INT2 NULL, col1_1 INT2 NOT NULL, col1_2 REGTYPE NULL, col1_3 TIMESTAMPTZ NOT NULL, col1_4 OID NULL, PRIMARY KEY (col1_3 DESC), FAMILY (col1_3), FAMILY (col1_4, col1_1, col1_2), FAMILY (col1_0));
        CREATE TABLE table2 (col2_0 DECIMAL NOT NULL, col2_1 BOX2D NULL, col2_2 GEOMETRY NOT NULL, col2_3 STRING NULL, col2_4 CHAR[] NOT NULL, col2_5 BIT, col2_6 TIMESTAMPTZ, col2_7 OID NOT NULL, col2_8 INET NOT NULL, col2_9 GEOMETRY, col2_10 STRING NOT NULL AS (lower(CAST(col2_2 AS STRING))) STORED, col2_11 STRING NOT NULL AS (lower(CAST(col2_2 AS STRING))) STORED, col2_12 STRING NULL AS (lower(CAST(col2_1 AS STRING))) VIRTUAL, UNIQUE (col2_10 DESC) STORING (col2_0, col2_1, col2_2, col2_3, col2_4, col2_5, col2_6, col2_11) WHERE (table2.col2_6 >= '3000-01-01 00:00:00+00:00':::TIMESTAMPTZ) OR (table2.col2_11 <= e'\U00002603':::STRING));
        CREATE TABLE table3 (col3_0 DATE, col3_1 DATE NULL, col3_2 NAME NOT NULL, col3_3 DECIMAL NULL, col3_4 FLOAT8 NOT NULL, col3_5 UUID NULL, col3_6 VARCHAR NOT NULL, col3_7 CHAR NOT NULL, col3_8 STRING NOT NULL AS (lower(col3_6)) VIRTUAL, col3_9 DECIMAL NULL AS (col3_3 + 2.692846473459572488E+33:::DECIMAL) VIRTUAL, col3_10 DECIMAL NULL AS (col3_3 + 4.106142205282675718E+32:::DECIMAL) STORED, col3_11 STRING NULL AS (lower(CAST(col3_5 AS STRING))) VIRTUAL, col3_12 DECIMAL NULL AS (col3_3 + 307943614.7720024605:::DECIMAL) VIRTUAL, col3_13 STRING NULL AS (lower(CAST(col3_5 AS STRING))) VIRTUAL, col3_14 STRING AS (CASE WHEN col3_0 IS NULL THEN e'\U00002603':::STRING ELSE e'.@\x1d8"\x7f?':::STRING END) STORED, INDEX (col3_9, (col3_4 + (-0.21946308068438203):::FLOAT8) DESC, col3_2, lower(col3_6) ASC, col3_8, col3_11 ASC, col3_13, col3_14, col3_1 DESC, col3_5 DESC, col3_6 DESC, col3_10, col3_3 DESC, col3_0, col3_7), INDEX ((col3_4 + 1.476616016665823:::FLOAT8) DESC, col3_2) STORING (col3_0, col3_1, col3_5, col3_7, col3_10, col3_14) WHERE (((table3.col3_10 > (-1.234E+401):::DECIMAL) OR (table3.col3_11 < e'\'':::STRING)) AND (table3.col3_13 = '':::STRING)) OR (table3.col3_7 >= 'X':::STRING), UNIQUE ((CASE WHEN col3_1 IS NULL THEN '':::STRING ELSE e'\x13wm|':::STRING END)) STORING (col3_0, col3_3, col3_5, col3_10) WHERE (((table3.col3_14 < e'\x00':::STRING) OR (table3.col3_2 <= e'\U00002603':::STRING)) OR (table3.col3_4 >= 'NaN':::FLOAT8)) OR (table3.col3_8 > 'X':::STRING), UNIQUE (col3_12), INDEX (col3_3 DESC, col3_10, lower(col3_6) DESC, col3_9, (CASE WHEN col3_0 IS NULL THEN e'S"8Q\x1a':::STRING ELSE e'\x0bO\be\x03e':::STRING END) DESC, col3_0, col3_7 DESC, col3_6 DESC, lower(col3_6), col3_5, col3_14, col3_2 ASC, col3_11 ASC, col3_8) WHERE (((((((table3.col3_6 >= 'X':::STRING) OR (table3.col3_11 != e'\'':::STRING)) OR (table3.col3_12 > 'Infinity':::DECIMAL)) AND (table3.col3_14 <= e'\x00':::STRING)) OR (table3.col3_8 > e'\x00':::STRING)) AND (table3.col3_13 < e'\'':::STRING)) OR (table3.col3_1 = 'infinity':::DATE)) OR (table3.col3_3 < 1:::DECIMAL), UNIQUE (col3_7 DESC, col3_2 ASC, col3_8 ASC) STORING (col3_3, col3_4, col3_5, col3_6, col3_10), UNIQUE (col3_14 DESC, col3_3 DESC, col3_10, col3_6, col3_2 ASC, col3_8 ASC, col3_5 DESC) STORING (col3_0, col3_7) WHERE (((((((((((((table3.col3_10 > (-1.234E+401):::DECIMAL) AND (table3.col3_14 < e'\U00002603':::STRING)) OR (table3.col3_1 != '1970-01-01':::DATE)) AND (table3.col3_11 = '':::STRING)) OR (table3.col3_6 >= '"':::STRING)) OR (table3.col3_9 <= 'Infinity':::DECIMAL)) OR (table3.col3_13 > 'X':::STRING)) OR (table3.col3_7 < e'\'':::STRING)) AND (table3.col3_3 != 1:::DECIMAL)) AND (table3.col3_8 > '"':::STRING)) OR (table3.col3_0 >= '-infinity':::DATE)) AND (table3.col3_12 >= 1:::DECIMAL)) OR (table3.col3_4 <= 0.0:::FLOAT8)) OR (table3.col3_2 <= e'\U00002603':::STRING), INDEX (col3_12 DESC, col3_10, col3_6, col3_1 ASC) WHERE (table3.col3_14 >= e'\U00002603':::STRING) OR (table3.col3_12 < 'Infinity':::DECIMAL));
        CREATE TABLE table4 (col4_0 "char" NOT NULL, col4_1 REGPROC NOT NULL, col4_2 REGCLASS, col4_3 OID NULL, col4_4 INT8 NULL, col4_5 TIMESTAMP NULL, col4_6 REGNAMESPACE NULL, col4_7 TIMESTAMPTZ NULL, col4_8 JSONB NULL, col4_9 REGNAMESPACE, col4_10 BIT(17), col4_11 INET NOT NULL, col4_12 OID, col4_13 TIMESTAMPTZ NULL, col4_14 BOOL, col4_15 UUID NULL, col4_16 STRING NULL AS (lower(CAST(col4_8 AS STRING))) VIRTUAL);
        ALTER TABLE table1 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2056794, "histo_buckets": [{"distinct_range": 0, "num_eq": 3872036889656037523, "num_range": 0, "upper_bound": "1976-09-30 03:12:24.000841+00:00"}, {"distinct_range": 8265864507185394000, "num_eq": 177180940143896689, "num_range": 8796301801395020577, "upper_bound": "1981-03-27 05:58:01.000999+00:00"}, {"distinct_range": 0, "num_eq": 200000, "num_range": 0, "upper_bound": "1982-01-31 03:24:29.000601+00:00"}, {"distinct_range": 40000000, "num_eq": 40000, "num_range": 40000000, "upper_bound": "1984-07-24 09:12:13.000886+00:00"}, {"distinct_range": 5551426870890841000, "num_eq": 300000, "num_range": 6958047374494460572, "upper_bound": "2004-11-15 06:21:43.000876+00:00"}, {"distinct_range": 35.65109604168334, "num_eq": 5276535322725658380, "num_range": 80, "upper_bound": "2009-04-23 13:06:07.000984+00:00"}, {"distinct_range": 0, "num_eq": 3664958736357760901, "num_range": 800, "upper_bound": "2015-10-29 12:51:00.000935+00:00"}, {"distinct_range": 1516889910038994000, "num_eq": 4308865731901558813, "num_range": 1516889910038993801, "upper_bound": "2028-04-16 08:24:10.000479+00:00"}], "histo_col_type": "TIMESTAMPTZ", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3156623, "histo_col_type": "", "name": "__auto__", "null_count": 4875848, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3890231, "histo_col_type": "", "name": "__auto__", "null_count": 4115161, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4790850, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000}, {"avg_size": 0, "columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 659304, "histo_col_type": "", "name": "__auto__", "null_count": 1454579, "row_count": 5000000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1653678328, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 334315941, "histo_col_type": "", "name": "__auto__", "null_count": 589728258, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1232680092, "histo_col_type": "", "name": "__auto__", "null_count": 1876190020, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 704731856, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 518472281, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 954426785, "histo_col_type": "", "name": "__auto__", "null_count": 700729675, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1009094128, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 460546066, "histo_col_type": "", "name": "__auto__", "null_count": 355322287, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 410681471, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1348375688, "histo_col_type": "", "name": "__auto__", "null_count": 927511485, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 868173266, "histo_buckets": [{"distinct_range": 0, "num_eq": 2159022848307666326, "num_range": 0, "upper_bound": "\\u0015NL"}, {"distinct_range": 0, "num_eq": 200, "num_range": 2686222428642722914, "upper_bound": ".\\u00189\\u001e-e4:"}, {"distinct_range": 9573118.55552634, "num_eq": 3463473359745039523, "num_range": 60000000, "upper_bound": ">t>R"}, {"distinct_range": 2971095617725649000, "num_eq": 784953292885995824, "num_range": 2971095617725648927, "upper_bound": "``\\u0008vE\\\\"}, {"distinct_range": 9185349360677149000, "num_eq": 3513844098655872521, "num_range": 9185349360677149139, "upper_bound": "t"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 901503566, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2000000000}, {"avg_size": 0, "columns": ["col2_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 781414952, "histo_col_type": "", "name": "__auto__", "null_count": 947258555, "row_count": 2000000000}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS e'[{"avg_size": 0, "columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 372252303481529096, "histo_col_type": "", "name": "__auto__", "null_count": 222413880144298014, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 377403779621178995, "histo_buckets": [{"distinct_range": 0, "num_eq": 20000000000, "num_range": 0, "upper_bound": "\\u0007"}, {"distinct_range": 4320872946286759000, "num_eq": 200, "num_range": 4320872946286759158, "upper_bound": " "}, {"distinct_range": 575611314466201600, "num_eq": 1980651371626435740, "num_range": 7598972240722281981, "upper_bound": "\'"}, {"distinct_range": 1306681.809449923, "num_eq": 6888521358316634997, "num_range": 2000000, "upper_bound": "D"}, {"distinct_range": 1253861943637538800, "num_eq": 3675575095694275826, "num_range": 2132434549688900817, "upper_bound": "F"}, {"distinct_range": 1850909052009251300, "num_eq": 2000000000, "num_range": 1850909052009251257, "upper_bound": "G"}, {"distinct_range": 3145932095747061000, "num_eq": 600000000, "num_range": 7533113692216273861, "upper_bound": "|"}], "histo_col_type": "CHAR", "name": "__auto__", "null_count": 0, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 102897521693967207, "histo_col_type": "", "name": "__auto__", "null_count": 68936050490420327, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 276123514933209981, "histo_col_type": "", "name": "__auto__", "null_count": 320186636896411655, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 132167094710725925, "histo_buckets": [{"distinct_range": 0, "num_eq": 2000000000, "num_range": 0, "upper_bound": "-88128706529099.12671"}, {"distinct_range": 8.110707172994866, "num_eq": 8981835986847436911, "num_range": 80, "upper_bound": "509620067.1211514109"}], "histo_col_type": "DECIMAL", "name": "__auto__", "null_count": 251946862285028856, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 164334310177706775, "histo_col_type": "", "name": "__auto__", "null_count": 441961665159506664, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 352398116933352030, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 95833001427130795, "histo_col_type": "", "name": "__auto__", "null_count": 247048375359969560, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 71348415639199193, "histo_buckets": [{"distinct_range": 0, "num_eq": 80, "num_range": 0, "upper_bound": "-4.870105180962941083E+27"}, {"distinct_range": 0, "num_eq": 3129164818862978094, "num_range": 4000000, "upper_bound": "-4.327534815996843182E+27"}, {"distinct_range": 336922100654836900, "num_eq": 4533463836510994825, "num_range": 4265055103694125241, "upper_bound": "Infinity"}], "histo_col_type": "DECIMAL", "name": "__auto__", "null_count": 329061166340749166, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 306403412479617622, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 43141736587618654, "histo_col_type": "", "name": "__auto__", "null_count": 451040582628609610, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 67663642306866505, "histo_buckets": [{"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "-1.198804477681579831E+24"}, {"distinct_range": 1385091522101724700, "num_eq": 3905834639871813560, "num_range": 2787998252046081043, "upper_bound": "-91127.87503967928726"}, {"distinct_range": 0, "num_eq": 1000000, "num_range": 8015361103633778583, "upper_bound": "-144.3688722434980055"}, {"distinct_range": 16334131.733860262, "num_eq": 8000000000, "num_range": 20000000, "upper_bound": "7.95921878979517959E+32"}], "histo_col_type": "DECIMAL", "name": "__auto__", "null_count": 156120131745494367, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 247383188083006405, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 395546333299093542, "histo_buckets": [{"distinct_range": 0, "num_eq": 2145684121291144921, "num_range": 0, "upper_bound": "\\u0007\\u0004g"}, {"distinct_range": 5000, "num_eq": 8565863081536210968, "num_range": 5000, "upper_bound": "\\""}, {"distinct_range": 451469609859840640, "num_eq": 1000000, "num_range": 3018341246838791170, "upper_bound": "YP\\tv!Yx"}, {"distinct_range": 0, "num_eq": 0, "num_range": 100, "upper_bound": "^Is \\u0007{hVE"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 13498134572757510, "row_count": 463160159070022454}, {"avg_size": 0, "columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 118956321875100258, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 463160159070022454}]':::JSONB;
        ALTER TABLE table4 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col4_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 56985994, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 31730853, "histo_col_type": "", "name": "__auto__", "null_count": 24675944, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 41422800, "histo_col_type": "", "name": "__auto__", "null_count": 61248243, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 37759400, "histo_col_type": "", "name": "__auto__", "null_count": 39547895, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 35993048, "histo_col_type": "", "name": "__auto__", "null_count": 35042779, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 52629857, "histo_col_type": "", "name": "__auto__", "null_count": 56036412, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4593362, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 52163819, "histo_col_type": "", "name": "__auto__", "null_count": 25520438, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 59147082, "histo_col_type": "", "name": "__auto__", "null_count": 30800298, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2938164, "histo_col_type": "", "name": "__auto__", "null_count": 66595370, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 31983442, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 24975680, "histo_col_type": "", "name": "__auto__", "null_count": 52551582, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 12150785, "histo_col_type": "", "name": "__auto__", "null_count": 23396068, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 32254448, "histo_col_type": "", "name": "__auto__", "null_count": 41324510, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 795367, "histo_col_type": "", "name": "__auto__", "null_count": 30647597, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 16284488, "histo_col_type": "", "name": "__auto__", "null_count": 26930205, "row_count": 70000000}, {"avg_size": 0, "columns": ["col4_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 58299343, "histo_col_type": "", "name": "__auto__", "null_count": 49890990, "row_count": 70000000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('nbp', 'bk', 'ipw', 'qbrser', 'czyx', 'neohxr');
        CREATE TYPE rand_typ_1 AS ENUM ('xbl', 'o', 'fg');
        CREATE TYPE rand_typ_2 AS ENUM ('zx', 'n');
        CREATE TYPE rand_typ_3 AS ENUM ('e', 'yrscl', 'rvzylb');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith603488638
--- FAIL: TestRandomSyntaxSQLSmith (334.09s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

sql/tests.TestRandomSyntaxSQLSmith failed with artifacts on master @ 95c82a7dbc6d6fecb63edbd666c9986d1ad3885b:

Random syntax error:

    rsg_test.go:782: Crash detected: server panic: pq: internal error: expected *DJSON, found tree.dNull

Query:

        WITH
        	with_309417 (col_1768531, col_1768532, col_1768533, col_1768534)
        		AS (
        			SELECT
        				*
        			FROM
        				(
        					VALUES
        						(
        							3242033587:::OID,
        							0.6294165253639221:::FLOAT8,
        							crdb_internal.merge_transaction_stats((NULL::JSONB || ARRAY['1':::JSONB]::JSONB[])::JSONB[]::JSONB[])::JSONB,
        							2677140898:::OID
        						),
        						(
        							NULL,
        							0.006662753410637379:::FLOAT8,
        							json_set(NULL::JSONB, ARRAY[e'&B\x1d-\x1c':::STRING,e'\x05A':::STRING,e'wP\x01];\b9':::STRING,e'TG=NU\x10':::STRING,e'|\x1bV\\\f\x1dpH&':::STRING,'':::STRING,e'\x7fN{5\t5s':::STRING]::STRING[], ('[[{"a": null}, {"At6P*s&(@": []}, []], [{"baz": false}], {"AR]BYm#gZ": true}, {}]':::JSONB::JSONB - COALESCE(e'\x7f':::STRING, version()::STRING)::STRING)::JSONB::JSONB)::JSONB,
        							4218246637:::OID
        						),
        						(1379724405:::OID, 0.5823662877082825:::FLOAT8, NULL, 1087321610:::OID),
        						(
        							2860851028:::OID,
        							0.6245289444923401:::FLOAT8,
        							'[[{}], {"C#WUI:": {".X;T+8#s,m0": false, "b": "baz"}}, [{"baz": {";9h&zO": {}, "foo": {}}}, 1.256420958630052]]':::JSONB,
        							CASE
        							WHEN false THEN 160392574:::OID
        							ELSE 3610529231:::OID
        							END
        						),
        						(NULL, (-0.004027443006634712):::FLOAT8, '"a"':::JSONB, 1955241515:::OID),
        						(
        							4158924874:::OID,
        							0.2036065310239792:::FLOAT8,
        							'[[{"%HD": false, "@jw-/KE": {}, "bar": 0.45985449392157135, "fQ?LI": 0.04415233555838749}]]':::JSONB,
        							2830435222:::OID
        						)
        				)
        					AS tab_757326 (col_1768531, col_1768532, col_1768533, col_1768534)
        		)
        SELECT
        	2697483703:::OID AS col_1768535,
        	cte_ref_89340.col_1768531 AS col_1768536,
        	cte_ref_89340.col_1768532 AS col_1768537,
        	cte_ref_89340.col_1768533 AS col_1768538
        FROM
        	with_309417 AS cte_ref_89340
        WHERE
        	NULL ~ 'tM7u|}k':::STRING;

Schema:

    rsg_test.go:599: To reproduce, use schema:
    rsg_test.go:601: 
        		SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        	CREATE TABLE table1 (col1_0 GEOMETRY NOT NULL, col1_1 CHAR NOT NULL, col1_2 GEOMETRY NULL, col1_3 REGNAMESPACE, col1_4 DATE, col1_5 BIT(3) NULL, col1_6 INT4 NOT NULL, col1_7 JSONB NULL, col1_8 INTERVAL NOT NULL, col1_9 JSONB NULL, col1_10 BOX2D NOT NULL, col1_11 INT2 NOT NULL, col1_12 INT4 NOT NULL, col1_13 BIT(48), col1_14 REGNAMESPACE NOT NULL, col1_15 JSONB, col1_16 INTERVAL NOT NULL, col1_17 VARCHAR, col1_18 INT8, INVERTED INDEX (col1_6, (CASE WHEN col1_16 IS NULL THEN 'nka':::STRING ELSE 'X':::STRING END) DESC, col1_1 ASC, col1_8, lower(CAST(col1_10 AS STRING)), col1_16, lower(CAST(col1_15 AS STRING)) ASC, col1_4 DESC, (CASE WHEN col1_8 IS NULL THEN e'H\x0f<':::STRING ELSE '':::STRING END) DESC, col1_12 ASC, col1_10, col1_5 ASC, col1_18 ASC, col1_14 ASC, (CASE WHEN col1_8 IS NULL THEN e'42\n':::STRING ELSE e'LZ\x07H\f\x13\f':::STRING END) DESC, col1_2), INDEX (col1_1 DESC) STORING (col1_0, col1_2, col1_3, col1_4, col1_5, col1_7, col1_8, col1_10, col1_12, col1_15, col1_16, col1_17, col1_18) WHERE ((((((table1.col1_17 > 'X':::STRING) OR (table1.col1_4 >= '4714-11-24 BC':::DATE)) OR (table1.col1_18 <= (-1):::INT8)) OR (table1.col1_12 > (-32768):::INT8)) AND (table1.col1_11 != 127:::INT8)) AND (table1.col1_1 = 'X':::STRING)) AND (table1.col1_6 < 32767:::INT8), INDEX (col1_5));
        CREATE TABLE table2 (col2_0 NAME NULL, col2_1 GEOMETRY[], col2_2 UUID NOT NULL, col2_3 REGCLASS, col2_4 INT8 NULL, col2_5 GEOMETRY NOT NULL, col2_6 INT8 NOT NULL AS (col2_4 + (-1222484204189202969):::INT8) STORED, col2_7 STRING AS (CASE WHEN col2_3 IS NULL THEN '':::STRING ELSE e'\\\x10e':::STRING END) VIRTUAL, col2_8 STRING NULL AS (lower(col2_0)) VIRTUAL, col2_9 STRING AS (CASE WHEN col2_1 IS NULL THEN '':::STRING ELSE ' 8':::STRING END) STORED, col2_10 STRING AS (CASE WHEN col2_1 IS NULL THEN e'\t\x19\x01U':::STRING ELSE NULL END) STORED, PRIMARY KEY (col2_6 ASC));
        CREATE TABLE table3 (col3_0 FLOAT8 NULL, col3_1 REGNAMESPACE NOT NULL, col3_2 BOX2D NOT NULL, col3_3 OID[] NULL, INDEX (col3_0 ASC) STORING (col3_1, col3_2, col3_3) WHERE table3.col3_0 >= 0.0:::FLOAT8, INVERTED INDEX (col3_0, col3_1 ASC, col3_2, col3_3), INVERTED INDEX (col3_3) WHERE table3.col3_0 != '-Inf':::FLOAT8, INVERTED INDEX (col3_3 ASC) WHERE table3.col3_0 >= 0.0:::FLOAT8, UNIQUE (col3_0, col3_2 ASC, col3_1) WHERE table3.col3_0 <= 'NaN':::FLOAT8, INVERTED INDEX (col3_3 ASC) WHERE table3.col3_0 > 5e-324:::FLOAT8);
        CREATE TABLE table4 (col4_0 CHAR NOT NULL, col4_1 DATE NULL, col4_2 UUID NOT NULL, col4_3 STRING NOT NULL, col4_4 GEOMETRY NULL, col4_5 TIMETZ, col4_6 REGPROC NULL, col4_7 REGTYPE NOT NULL, col4_8 INET NULL, col4_9 INT8 NULL, col4_10 TIMESTAMPTZ, col4_11 DECIMAL, col4_12 INT8 NOT NULL, col4_13 GEOMETRY NOT NULL, col4_14 STRING, col4_15 JSONB NULL, col4_16 FLOAT4 NULL, col4_17 BIT(31), UNIQUE (col4_5 DESC, col4_16 DESC, lower(CAST(col4_17 AS STRING)) ASC, col4_14 DESC, col4_12 ASC, col4_3, col4_8, col4_0 ASC, col4_10, col4_6 DESC) STORING (col4_7, col4_9, col4_11, col4_17), INDEX (col4_16 DESC, col4_9, col4_3 ASC, col4_14 ASC, col4_12, col4_0, col4_10, col4_6 ASC, col4_1 ASC) STORING (col4_5, col4_11, col4_13, col4_15), FAMILY (col4_16, col4_8, col4_14), FAMILY (col4_12, col4_2), FAMILY (col4_17), FAMILY (col4_7), FAMILY (col4_10), FAMILY (col4_1, col4_5), FAMILY (col4_11, col4_9), FAMILY (col4_13), FAMILY (col4_4, col4_6, col4_0), FAMILY (col4_15), FAMILY (col4_3));
        ALTER TABLE table1 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col1_12"], "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_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": ["col1_3"], "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_6"], "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_11"], "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_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": ["col1_13"], "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_15"], "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_18"], "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_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_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 0, "histo_col_type": "BIT(3)", "name": "__auto__", "null_count": 0, "row_count": 0}, {"avg_size": 0, "columns": ["col1_17"], "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_10"], "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_14"], "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_16"], "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_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": ["col1_8"], "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_9"], "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;
        ALTER TABLE table2 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 14228730, "histo_col_type": "", "name": "__auto__", "null_count": 18935215, "row_count": 50000000}, {"avg_size": 0, "columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 33696626, "histo_col_type": "", "name": "__auto__", "null_count": 31819778, "row_count": 50000000}, {"avg_size": 0, "columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 49089583, "histo_col_type": "", "name": "__auto__", "null_count": 32727746, "row_count": 50000000}, {"avg_size": 0, "columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 32726189, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000000}, {"avg_size": 0, "columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 41116191, "histo_col_type": "", "name": "__auto__", "null_count": 29717534, "row_count": 50000000}, {"avg_size": 0, "columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 34531803, "histo_col_type": "", "name": "__auto__", "null_count": 29925397, "row_count": 50000000}, {"avg_size": 0, "columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 23160344, "histo_col_type": "", "name": "__auto__", "null_count": 902342, "row_count": 50000000}, {"avg_size": 0, "columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 30197747, "histo_col_type": "", "name": "__auto__", "null_count": 27031284, "row_count": 50000000}, {"avg_size": 0, "columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 28349856, "histo_col_type": "", "name": "__auto__", "null_count": 27644648, "row_count": 50000000}, {"avg_size": 0, "columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 41767858, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000000}, {"avg_size": 0, "columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 12047249, "histo_buckets": [{"distinct_range": 0, "num_eq": 2628894003884148438, "num_range": 0, "upper_bound": "-4982914182876258303"}, {"distinct_range": 90, "num_eq": 3621000271497418352, "num_range": 90, "upper_bound": "-56475079115637935"}, {"distinct_range": 8000, "num_eq": 800000, "num_range": 8000, "upper_bound": "6757524344644173664"}], "histo_col_type": "INT8", "name": "__auto__", "null_count": 0, "row_count": 50000000}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 422154, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 600000}, {"avg_size": 0, "columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 386008, "histo_col_type": "BYTES", "name": "__auto__", "null_count": 540079, "row_count": 600000}, {"avg_size": 0, "columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 351148, "histo_buckets": [{"distinct_range": 0, "num_eq": 8881193110036325069, "num_range": 0, "upper_bound": "-0.0865784303473772"}, {"distinct_range": 8708657428.624187, "num_eq": 5659197697190514718, "num_range": 50000000000, "upper_bound": "0.05977972322448677"}, {"distinct_range": 9038536273691700000, "num_eq": 0, "num_range": 9038536273691700023, "upper_bound": "0.25031968151222855"}, {"distinct_range": 0, "num_eq": 739179105532743384, "num_range": 8110838793896793182, "upper_bound": "0.3269549431563332"}, {"distinct_range": 0, "num_eq": 7682451001799054820, "num_range": 4371096321963769402, "upper_bound": "1.579333889710746"}], "histo_col_type": "FLOAT8", "name": "__auto__", "null_count": 78123, "row_count": 600000}, {"avg_size": 0, "columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 37486, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 600000}]':::JSONB;
        ALTER TABLE table4 INJECT STATISTICS '[{"avg_size": 0, "columns": ["col4_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 15858764, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 13698868, "histo_col_type": "", "name": "__auto__", "null_count": 13313783, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2322515, "histo_col_type": "", "name": "__auto__", "null_count": 9993718, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1608695, "histo_col_type": "", "name": "__auto__", "null_count": 17293814, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7296079, "histo_buckets": [{"distinct_range": 0, "num_eq": 3486383225104511911, "num_range": 0, "upper_bound": "NaN"}, {"distinct_range": 40, "num_eq": 10000000, "num_range": 40, "upper_bound": "-0.16143245995044708"}, {"distinct_range": 50000000000, "num_eq": 70, "num_range": 50000000000, "upper_bound": "0.2903536260128021"}, {"distinct_range": 480.39982124303646, "num_eq": 100, "num_range": 500, "upper_bound": "1.6422977447509766"}], "histo_col_type": "FLOAT4", "name": "__auto__", "null_count": 13847066, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 14702553, "histo_col_type": "", "name": "__auto__", "null_count": 13929337, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 9383203, "histo_col_type": "", "name": "__auto__", "null_count": 14691949, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 19485061, "histo_col_type": "", "name": "__auto__", "null_count": 3615049, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 18877400, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7518761, "histo_col_type": "", "name": "__auto__", "null_count": 5792497, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 13424384, "histo_col_type": "", "name": "__auto__", "null_count": 4633974, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4688651, "histo_col_type": "", "name": "__auto__", "null_count": 14649396, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8256818, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 18901129, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4779230, "histo_col_type": "", "name": "__auto__", "null_count": 16461778, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6220416, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 16484148, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 20000000}, {"avg_size": 0, "columns": ["col4_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 17007148, "histo_col_type": "", "name": "__auto__", "null_count": 12495621, "row_count": 20000000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('bvhriv', 'w', 'ew');
        CREATE TYPE rand_typ_1 AS ENUM ('o');
        CREATE TYPE rand_typ_2 AS ENUM ('cfov');
        ;
    rsg_test.go:601: 
        CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
        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;
        
        INSERT INTO seed DEFAULT VALUES;
        CREATE INDEX on seed (_int8, _float8, _date);
        CREATE INVERTED INDEX on seed (_jsonb);
        ;
    rsg_test.go:603: 
    rsg_test.go:604: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith2318045018
--- FAIL: TestRandomSyntaxSQLSmith (300.80s)
Help

See also: How To Investigate a Go Test Failure (internal)

Same failure on other branches

This test on roachdash | Improve this report!

@mgartner mgartner changed the title sql/tests: TestRandomSyntaxSQLSmith failed sql: internal error: expected *DJSON, found tree.dNull Apr 11, 2022
@mgartner
Copy link
Collaborator

All the latest expected *DJSON, found tree.dNull failures were fixed by #75760. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-robot Originated from a bot. T-sql-queries SQL Queries Team
Projects
Archived in project
Development

No branches or pull requests

6 participants