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/tests: TestRandomSyntaxSQLSmith failed #63794

Closed
cockroach-teamcity opened this issue Apr 16, 2021 · 26 comments · Fixed by #64342
Closed

sql/tests: TestRandomSyntaxSQLSmith failed #63794

cockroach-teamcity opened this issue Apr 16, 2021 · 26 comments · Fixed by #64342
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.

Comments

@cockroach-teamcity
Copy link
Member

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

        		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 BYTES NOT NULL, col1_2 BOX2D NOT NULL, col1_3 STRING, col1_4 REGCLASS NOT NULL, col1_5 OID NOT NULL, col1_6 TIME NULL, col1_7 "char" NOT NULL, col1_8 FLOAT8 NOT NULL, PRIMARY KEY (col1_7 ASC, col1_0 ASC, col1_5, col1_2 DESC), col1_9 FLOAT8 NOT NULL AS (col1_8 + 1.3773005161840057:::FLOAT8) VIRTUAL, col1_10 FLOAT8 NOT NULL AS (col1_8 + 5e-324:::FLOAT8) VIRTUAL, UNIQUE (col1_5 ASC, col1_4 DESC, col1_3 ASC, col1_6, col1_2 DESC, col1_0, col1_1 DESC, col1_7, col1_8 ASC, col1_9, col1_10 DESC), INDEX (col1_1, col1_0 ASC, col1_7, col1_4 ASC, col1_6, col1_10 DESC, col1_3 DESC, col1_8 ASC, col1_9, col1_2), UNIQUE (col1_2, col1_6 ASC) WHERE (((((table1.col1_10 > 5e-324:::FLOAT8) OR (table1.col1_7 >= e'\x00':::STRING)) OR (table1.col1_9 >= 0.0:::FLOAT8)) AND (table1.col1_8 <= 0.0:::FLOAT8)) OR (table1.col1_6 >= '24:00:00':::TIME)) OR (table1.col1_1 = '\x27':::BYTES), UNIQUE (col1_1 DESC, col1_5 DESC, col1_10 DESC, col1_3 DESC, col1_4 ASC, col1_6 DESC, col1_2 ASC, col1_0 DESC, col1_7, col1_9 DESC) WHERE ((((((table1.col1_1 <= '\xe29883':::BYTES) AND (table1.col1_6 >= '24:00:00':::TIME)) OR (table1.col1_7 < e'\'':::STRING)) OR (table1.col1_9 = 1.401298464324817e-45:::FLOAT8)) OR (table1.col1_8 > 1.0:::FLOAT8)) AND (table1.col1_3 > 'X':::STRING)) OR (table1.col1_10 != 1.7976931348623157e+308:::FLOAT8), UNIQUE (col1_9 DESC, col1_2, col1_1 DESC, col1_8, col1_6, col1_7 DESC, col1_4, col1_10 ASC, col1_3 ASC) WHERE ((((((table1.col1_10 < 5e-324:::FLOAT8) AND (table1.col1_6 >= '00:00:00':::TIME)) AND (table1.col1_3 >= '':::STRING)) OR (table1.col1_9 < 3.4028234663852886e+38:::FLOAT8)) OR (table1.col1_7 = e'\'':::STRING)) AND (table1.col1_8 > 'NaN':::FLOAT8)) AND (table1.col1_1 != '\x':::BYTES), UNIQUE (col1_2 ASC) WHERE ((((((table1.col1_1 >= '\x00':::BYTES) AND (table1.col1_7 <= '':::STRING)) OR (table1.col1_3 <= 'X':::STRING)) OR (table1.col1_6 >= '24:00:00':::TIME)) OR (table1.col1_9 >= 'NaN':::FLOAT8)) OR (table1.col1_10 = (-1.0):::FLOAT8)) AND (table1.col1_8 != '-Inf':::FLOAT8), INDEX (col1_5 ASC, col1_3 DESC, col1_4 ASC, col1_7 ASC, col1_1, col1_10, col1_0, col1_9, col1_6 DESC, col1_2 DESC, col1_8), UNIQUE (col1_10 DESC, col1_2 DESC, col1_1 ASC, col1_4 DESC, col1_0 DESC, col1_5 ASC, col1_9, col1_6 DESC, col1_7 DESC, col1_8 ASC, col1_3), INDEX (col1_1 DESC, col1_0 DESC, col1_7, col1_4, col1_2 ASC, col1_9 ASC) STORING (col1_3) WHERE ((((table1.col1_1 = '\x22':::BYTES) OR (table1.col1_7 < e'\'':::STRING)) AND (table1.col1_8 != 5e-324:::FLOAT8)) AND (table1.col1_3 = e'\x00':::STRING)) AND (table1.col1_6 >= '24:00:00':::TIME));
        CREATE TABLE table2 (col1_7 "char" NOT NULL, col1_0 REGCLASS NOT NULL, col1_5 OID NOT NULL, col1_2 BOX2D NOT NULL, col2_4 TIME NULL, col2_5 CHAR NULL, col2_6 CHAR NOT NULL, col2_7 VARCHAR, PRIMARY KEY (col1_7 ASC, col1_0 ASC, col1_5, col1_2 DESC, col2_4 DESC, col2_5 ASC)) INTERLEAVE IN PARENT table1 (col1_7, col1_0, col1_5, col1_2);
        CREATE TABLE table3 (col1_7 "char" NOT NULL, col1_0 REGCLASS NOT NULL, col1_5 OID NOT NULL, col1_2 BOX2D NOT NULL, col2_4 TIME NULL, col2_5 CHAR NULL, col3_6 FLOAT4, col3_7 OID NULL, col3_8 UUID, col3_9 BYTES NULL, col3_10 UUID, col3_11 REGPROCEDURE, col3_12 DATE NOT NULL, PRIMARY KEY (col1_7 ASC, col1_0 ASC, col1_5, col1_2 DESC, col2_4 DESC, col2_5 ASC, col3_12 DESC, col3_10, col3_11, col3_7, col3_6 DESC), INDEX (col3_11 DESC, col3_10 DESC, col1_0, col3_9 ASC, col3_8 DESC), INDEX (col1_2 ASC, col2_5, col3_7 DESC, col3_8 DESC, col3_9 DESC, col2_4 ASC, col1_5 ASC, col3_12, col3_10) WHERE (((table3.col3_6 != 1.401298464324817e-45:::FLOAT8) AND (table3.col3_12 != '5874897-12-31':::DATE)) AND (table3.col1_7 = 'X':::STRING)) OR (table3.col2_4 > '24:00:00':::TIME), FAMILY (col2_5, col1_5), FAMILY (col1_2, col3_8), FAMILY (col3_9, col3_7, col1_7, col3_12), FAMILY (col2_4, col3_11, col3_6), FAMILY (col3_10), FAMILY (col1_0)) INTERLEAVE IN PARENT table2 (col1_7, col1_0, col1_5, col1_2, col2_4, col2_5);
        ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 583315257927387854, "histo_buckets": [{"distinct_range": 0, "num_eq": 70000000000, "num_range": 0, "upper_bound": "BOX(-2.4531557528366648 -0.0990973198034264,-0.3997642801645894 1.5500267380235504)"}, {"distinct_range": 98305499.49233826, "num_eq": 300, "num_range": 100000000, "upper_bound": "BOX(-1.7397955270447985 0.009131873847102595,0.22146289780879092 1.3357815346966806)"}, {"distinct_range": 6598692249074859000, "num_eq": 7155845223373108092, "num_range": 6598692249074858666, "upper_bound": "BOX(-1.5565387971581253 -1.9643531378007095,0.4894505438364517 1.4855549900723681)"}, {"distinct_range": 17237174.29197722, "num_eq": 30, "num_range": 70000000, "upper_bound": "BOX(-1.3947627903478055 -0.4190993927318287,0.538812136891176 0.6641059933295035)"}, {"distinct_range": 50000000, "num_eq": 300000000, "num_range": 50000000, "upper_bound": "BOX(-1.313202309117495 0.4006987872557412,0.7204587014699675 0.8464100233735059)"}, {"distinct_range": 2681203782751339000, "num_eq": 400000000, "num_range": 2681203782751339093, "upper_bound": "BOX(-0.9828273637986815 -1.1525346027484524,-0.3060114012251681 1.5513737565311656)"}, {"distinct_range": 8000000000, "num_eq": 0, "num_range": 8000000000, "upper_bound": "BOX(-0.7126843840338173 -0.9244215524807329,0.26131790188652637 2.0236785024853443)"}, {"distinct_range": 63008923709392630, "num_eq": 300000000, "num_range": 63008923709392633, "upper_bound": "BOX(0.6245427114775328 -2.388787312474416,1.188716535575531 1.0077172780041124)"}], "histo_col_type": "BOX2D", "name": "__auto__", "null_count": 0, "row_count": 1233992803830609058}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 288079596947329356, "histo_col_type": "", "name": "__auto__", "null_count": 342801915831673397, "row_count": 1233992803830609058}, {"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 174372578502683605, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1233992803830609058}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 863728338889344853, "histo_col_type": "", "name": "__auto__", "null_count": 698362234642326199, "row_count": 1233992803830609058}, {"columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 907448095717725789, "histo_buckets": [{"distinct_range": 0, "num_eq": 57560909744638722, "num_range": 0, "upper_bound": "5e-324"}, {"distinct_range": 66247202926838730, "num_eq": 500000, "num_range": 9026761795946129627, "upper_bound": "0.5426508302560196"}, {"distinct_range": 92779.95891584475, "num_eq": 5000, "num_range": 900000, "upper_bound": "1.9036397874725939"}], "histo_col_type": "FLOAT8", "name": "__auto__", "null_count": 0, "row_count": 1233992803830609058}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 986594046708083875, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1233992803830609058}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 325463934541982156, "histo_buckets": [{"distinct_range": 0, "num_eq": 100, "num_range": 0, "upper_bound": "\\\\x"}, {"distinct_range": 0, "num_eq": 20000000, "num_range": 6332823711087544497, "upper_bound": "\\\\x1bbfa820"}, {"distinct_range": 513955.7646269461, "num_eq": 1000, "num_range": 800000, "upper_bound": "\\\\x25"}, {"distinct_range": 0, "num_eq": 8900061159235050643, "num_range": 324156515524200753, "upper_bound": "\\\\x320851251948"}, {"distinct_range": 26440120.88335758, "num_eq": 30000, "num_range": 50000000, "upper_bound": "\\\\x4e885f56"}, {"distinct_range": 700000, "num_eq": 1175063926053908796, "num_range": 700000, "upper_bound": "\\\\x5c"}, {"distinct_range": 40, "num_eq": 400000000, "num_range": 40, "upper_bound": "\\\\x6a581a1832df562d5d"}, {"distinct_range": 67782.30093854855, "num_eq": 900, "num_range": 70000, "upper_bound": "\\\\xdaad8d963988ef77"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 0, "row_count": 1233992803830609058}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1125839302204701520, "histo_buckets": [{"distinct_range": 0, "num_eq": 10000, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 200000, "num_eq": 8000000, "num_range": 200000, "upper_bound": "493446045"}, {"distinct_range": 0, "num_eq": 10000000000, "num_range": 5087113554452556583, "upper_bound": "574215490"}, {"distinct_range": 87.75220754413319, "num_eq": 2132419857272185833, "num_range": 500, "upper_bound": "1218929039"}, {"distinct_range": 0, "num_eq": 6669210206440261026, "num_range": 3730820937729769726, "upper_bound": "1506043985"}, {"distinct_range": 3545629.4414659445, "num_eq": 5000, "num_range": 80000000, "upper_bound": "2434862614"}, {"distinct_range": 2761366545866244000, "num_eq": 8000000000, "num_range": 3358043653482588631, "upper_bound": "2707129775"}, {"distinct_range": 20000, "num_eq": 200000000, "num_range": 20000, "upper_bound": "2803723137"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 0, "row_count": 1233992803830609058}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1164802164661110914, "histo_buckets": [{"distinct_range": 0, "num_eq": 566500466109706233, "num_range": 0, "upper_bound": "]"}], "histo_col_type": "\\"char\\"", "name": "__auto__", "null_count": 0, "row_count": 1233992803830609058}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 893561526998196163, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1233992803830609058}, {"columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 997630639492893932, "histo_buckets": [{"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "-0.539330892221158"}, {"distinct_range": 1138422821828577300, "num_eq": 8002003091368853856, "num_range": 2239939707341022561, "upper_bound": "1.0062571026899856"}, {"distinct_range": 0, "num_eq": 2000000, "num_range": 300000, "upper_bound": "1.4721906612466245"}, {"distinct_range": 8566826157459596000, "num_eq": 6246129815669671972, "num_range": 8566826157459596595, "upper_bound": "1.7976931348623157e+308"}], "histo_col_type": "FLOAT8", "name": "__auto__", "null_count": 0, "row_count": 1233992803830609058}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5917649249, "histo_col_type": "", "name": "__auto__", "null_count": 930144658, "row_count": 9000000000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3612675162, "histo_buckets": [{"distinct_range": 0, "num_eq": 100000, "num_range": 0, "upper_bound": "*"}, {"distinct_range": 5000000000, "num_eq": 9000000000, "num_range": 5000000000, "upper_bound": "+"}, {"distinct_range": 4524352100934469600, "num_eq": 7000000000, "num_range": 4524352100934469565, "upper_bound": "."}, {"distinct_range": 0, "num_eq": 71230918917380990, "num_range": 50, "upper_bound": "B"}, {"distinct_range": 1728164758134218200, "num_eq": 5000000, "num_range": 1728164758134218190, "upper_bound": "h"}, {"distinct_range": 0, "num_eq": 7450306375173374172, "num_range": 30, "upper_bound": "}"}], "histo_col_type": "\\"char\\"", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1200863132, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7253354586, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 887226940, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6404428911, "histo_col_type": "", "name": "__auto__", "null_count": 4380676735, "row_count": 9000000000}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2128704353, "histo_col_type": "", "name": "__auto__", "null_count": 7461329008, "row_count": 9000000000}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5865805013, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 9000000000}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS e'[{"columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 625, "histo_col_type": "", "name": "__auto__", "null_count": 808, "row_count": 1000}, {"columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 488, "histo_col_type": "", "name": "__auto__", "null_count": 462, "row_count": 1000}, {"columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 306, "histo_col_type": "", "name": "__auto__", "null_count": 583, "row_count": 1000}, {"columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 525, "histo_buckets": [{"distinct_range": 0, "num_eq": 580055445906278482, "num_range": 0, "upper_bound": "258544702"}, {"distinct_range": 0, "num_eq": 4035593933692959108, "num_range": 0, "upper_bound": "1433004060"}, {"distinct_range": 4094735997942822000, "num_eq": 500, "num_range": 4094735997942821871, "upper_bound": "1658991637"}, {"distinct_range": 0, "num_eq": 394586545125455591, "num_range": 3248112142103633772, "upper_bound": "3572339205"}, {"distinct_range": 21.705525729327846, "num_eq": 3685845911853848877, "num_range": 8000, "upper_bound": "3663889527"}], "histo_col_type": "REGPROCEDURE", "name": "__auto__", "null_count": 275, "row_count": 1000}, {"columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 492, "histo_col_type": "", "name": "__auto__", "null_count": 595, "row_count": 1000}, {"columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 440, "histo_col_type": "", "name": "__auto__", "null_count": 421, "row_count": 1000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 421, "histo_col_type": "\\"char\\"", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 106, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 373, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 710, "histo_buckets": [{"distinct_range": 0, "num_eq": 1000000000, "num_range": 0, "upper_bound": "BOX(-10 -10,10 10)"}, {"distinct_range": 0, "num_eq": 900000, "num_range": 1431061635211247489, "upper_bound": "BOX(-2.122603578483934 -0.815619614630809,1.907416457931932 -0.512095988239829)"}, {"distinct_range": 414119427.0833264, "num_eq": 500000, "num_range": 500000000, "upper_bound": "BOX(-1.7537458018944685 0.473677727684084,0.13363794878487845 0.9526488346000587)"}, {"distinct_range": 80000, "num_eq": 900000, "num_range": 80000, "upper_bound": "BOX(-1.505829931933616 -0.19682282350771507,-1.2788271721918543 0.011461930727336589)"}, {"distinct_range": 30381769833685976, "num_eq": 200, "num_range": 31973940567673218, "upper_bound": "BOX(-0.686724094266756 0.8771511766610092,0.8841211232228714 2.377979729439657)"}], "histo_col_type": "BOX2D", "name": "__auto__", "null_count": 0, "row_count": 1000}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 24, "histo_col_type": "", "name": "__auto__", "null_count": 377, "row_count": 1000}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 243, "histo_col_type": "", "name": "__auto__", "null_count": 972, "row_count": 1000}, {"columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 399, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('v', 'crgip', 'miv');
        CREATE TYPE rand_typ_1 AS ENUM ('vu', 'rgwyp', 'tsjtq', 'enffgt', 'eeleds');
        CREATE TYPE rand_typ_2 AS ENUM ('vtbban', 'nrvj', 'zf', 'j', 'yf');
        CREATE TYPE rand_typ_3 AS ENUM ('n', 'oi', 'oamqe', 'd', 'zj');
        CREATE TYPE rand_typ_4 AS ENUM ('y', 'wq');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith788820810
--- FAIL: TestRandomSyntaxSQLSmith (300.80s)
Reproduce

To reproduce, try:

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

Internal log

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

/cc @rafiss

This test on roachdash | Improve this report!

@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 Apr 16, 2021
@cockroach-teamcity
Copy link
Member Author

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

        SET enable_drop_enum_value = true;
        
        		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 BIT(8) NOT NULL, col1_1 BOOL NOT NULL, col1_2 OID NOT NULL, col1_3 INT2 NOT NULL, col1_4 DECIMAL, col1_5 DATE NOT NULL, col1_6 TIMETZ NOT NULL, col1_7 UUID NOT NULL, PRIMARY KEY (col1_1 DESC, col1_0 DESC, col1_7 DESC, col1_5, col1_6 DESC, col1_3 ASC, col1_2), col1_8 STRING NOT NULL AS (lower(CAST(col1_5 AS STRING))) STORED, INDEX (col1_3 DESC, col1_1 DESC, col1_8, col1_4, col1_5, col1_2 DESC, col1_7 DESC), INDEX (col1_2 ASC, col1_1, col1_3, col1_7 DESC, col1_6) WHERE ((((table1.col1_4 >= '-Infinity':::DECIMAL) AND (table1.col1_6 >= '24:00:00-15:59:00':::TIMETZ)) OR (table1.col1_8 <= '':::STRING)) OR (table1.col1_5 < '4714-11-24 BC':::DATE)) OR (table1.col1_3 < 32767:::INT8), UNIQUE (col1_8, col1_2 DESC, col1_3 ASC, col1_5 DESC, col1_1 DESC), INDEX (col1_2, col1_5), UNIQUE (col1_1, col1_4 ASC, col1_3 DESC, col1_6, col1_5 ASC, col1_7 ASC, col1_8 DESC, col1_2) WHERE (table1.col1_4 >= 1:::DECIMAL) AND (table1.col1_5 >= '5874897-12-31':::DATE), INDEX (col1_3 ASC, col1_0 ASC, col1_5 ASC) STORING (col1_8) WHERE table1.col1_1 AND (table1.col1_3 > 1:::INT8), INDEX (col1_6, col1_3 ASC) STORING (col1_4, col1_8), INDEX (col1_2, col1_7, col1_8 ASC, col1_0 DESC, col1_3, col1_6 ASC, col1_1, col1_4 ASC) WHERE (table1.col1_6 = '00:00:00+15:59:00':::TIMETZ) AND (table1.col1_5 >= '4714-11-24 BC':::DATE), INDEX (col1_4, col1_3 DESC, col1_7 ASC, col1_2 DESC, col1_6 ASC, col1_1 ASC, col1_5 DESC) WHERE (((((table1.col1_6 >= '24:00:00-15:59:00':::TIMETZ) AND (table1.col1_4 < (-1):::DECIMAL)) OR (table1.col1_8 != e'\U00002603':::STRING)) OR (table1.col1_3 = 1:::INT8)) AND (NOT table1.col1_1)) OR (table1.col1_5 > '1970-01-01':::DATE));
        CREATE TABLE table2 (col2_0 CHAR NULL, col2_1 GEOMETRY NULL, col2_2 GEOGRAPHY NOT NULL, col2_3 REGTYPE, col2_4 BYTES, col2_5 UUID, col2_6 STRING AS (CASE WHEN col2_4 IS NULL THEN 'N':::STRING ELSE '':::STRING END) STORED, col2_7 STRING NULL AS (lower(col2_0)) STORED, col2_8 STRING AS (CASE WHEN col2_4 IS NULL THEN 'r':::STRING ELSE e'*6\x16':::STRING END) VIRTUAL, col2_9 STRING NULL AS (lower(col2_0)) VIRTUAL, INDEX (col2_4 ASC, col2_8 ASC), INVERTED INDEX (col2_2 DESC) WHERE table2.col2_6 = '"':::STRING, INDEX (col2_7 DESC) STORING (col2_0, col2_2, col2_4), INVERTED INDEX (col2_9 ASC, col2_7 DESC, col2_0, col2_6 ASC, col2_8 ASC, col2_4 ASC, col2_3 DESC, col2_2 ASC), INDEX (col2_4 DESC, col2_6 DESC, col2_5 ASC) STORING (col2_2), UNIQUE (col2_0 DESC, col2_8 DESC, col2_3 ASC, col2_4 DESC, col2_6 DESC) WHERE (((((table2.col2_8 >= e'\x00':::STRING) AND (table2.col2_7 >= '':::STRING)) AND (table2.col2_4 >= '\x00':::BYTES)) OR (table2.col2_0 > e'\x00':::STRING)) AND (table2.col2_6 >= '':::STRING)) AND (table2.col2_9 < e'\x00':::STRING), FAMILY (col2_6, col2_2, col2_7), FAMILY (col2_1), FAMILY (col2_3, col2_0, col2_4, col2_5));
        CREATE TABLE table3 (col3_0 INT2, col3_1 TIMESTAMPTZ NOT NULL, col3_2 CHAR NOT NULL, col3_3 VARCHAR NULL, col3_4 VARCHAR, col3_5 FLOAT8 NOT NULL, col3_6 REGPROCEDURE, col3_7 GEOGRAPHY, col3_8 OID, col3_9 STRING NULL, col3_10 TIMESTAMP, col3_11 REGPROC, col3_12 INT4 NOT NULL, col3_13 GEOGRAPHY NOT NULL, col3_14 INT8 NOT NULL, PRIMARY KEY (col3_5 DESC, col3_1), col3_15 INT4 AS (col3_12 + col3_14) VIRTUAL, col3_16 STRING AS (lower(CAST(col3_10 AS STRING))) STORED, FAMILY (col3_13), FAMILY (col3_4, col3_11), FAMILY (col3_10), FAMILY (col3_14), FAMILY (col3_16), FAMILY (col3_3), FAMILY (col3_8), FAMILY (col3_9), FAMILY (col3_12), FAMILY (col3_1, col3_5, col3_2), FAMILY (col3_6, col3_0, col3_7));
        ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3432, "histo_buckets": [{"distinct_range": 0, "num_eq": 40, "num_range": 0, "upper_bound": "-8071"}, {"distinct_range": 2860087433997913600, "num_eq": 2000, "num_range": 3620502857012601441, "upper_bound": "20975"}, {"distinct_range": 42177026013971090, "num_eq": 10000000, "num_range": 8334082438522879528, "upper_bound": "30394"}], "histo_col_type": "INT2", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6855, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1800, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4832, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2689, "histo_buckets": [{"distinct_range": 0, "num_eq": 2984197463322861850, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 0, "num_eq": 4000, "num_range": 30000000, "upper_bound": "70558795"}, {"distinct_range": 2957763307794631700, "num_eq": 90, "num_range": 8758359606310102970, "upper_bound": "949975026"}, {"distinct_range": 0, "num_eq": 30000, "num_range": 200, "upper_bound": "956195559"}, {"distinct_range": 0, "num_eq": 0, "num_range": 8000, "upper_bound": "1138404297"}, {"distinct_range": 0, "num_eq": 1454661804234915163, "num_range": 553714627610241724, "upper_bound": "2343731445"}, {"distinct_range": 0, "num_eq": 80, "num_range": 7025245110284449105, "upper_bound": "3035680172"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3161, "histo_buckets": [{"distinct_range": 0, "num_eq": 8209733581151198445, "num_range": 0, "upper_bound": "296489376.047037284"}, {"distinct_range": 366230214557651000, "num_eq": 8503033353814028224, "num_range": 2911033028846665436, "upper_bound": "140281176305039710.9"}, {"distinct_range": 8000000, "num_eq": 6000000, "num_range": 8000000, "upper_bound": "5.172379502231524589E+25"}, {"distinct_range": 0, "num_eq": 300000000, "num_range": 2097417642109105357, "upper_bound": "7.448615333637386959E+29"}], "histo_col_type": "DECIMAL", "name": "__auto__", "null_count": 4823, "row_count": 10000}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3155, "histo_buckets": [{"distinct_range": 0, "num_eq": 6701423377587903499, "num_range": 0, "upper_bound": "12:25:38.232838+07:26:00"}, {"distinct_range": 6727037721699796000, "num_eq": 50, "num_range": 6727037721699796010, "upper_bound": "15:48:11.367139+02:06:00"}, {"distinct_range": 5289204294334514000, "num_eq": 8451568146588816887, "num_range": 5824260813763934298, "upper_bound": "07:25:56.16758-12:03:00"}, {"distinct_range": 2152779800286133000, "num_eq": 8042073515934645456, "num_range": 2152779800286132904, "upper_bound": "24:00:00-15:59:00"}], "histo_col_type": "TIMETZ", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4609, "histo_buckets": [{"distinct_range": 0, "num_eq": 800000, "num_range": 0, "upper_bound": "2\\u000e2\\u0018v\\u001b\\u0019sL"}, {"distinct_range": 831530482228560300, "num_eq": 50000000000, "num_range": 831530482228560244, "upper_bound": "d=f"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1283, "histo_buckets": [{"distinct_range": 0, "num_eq": 50000000000, "num_range": 0, "upper_bound": "false"}, {"distinct_range": 2115847429150123800, "num_eq": 1755197066118375064, "num_range": 2115847429150123720, "upper_bound": "true"}], "histo_col_type": "BOOL", "name": "__auto__", "null_count": 0, "row_count": 10000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 347, "histo_buckets": [{"distinct_range": 0, "num_eq": 1645840271581996351, "num_range": 0, "upper_bound": "\\u0006"}, {"distinct_range": 10000000, "num_eq": 9000000, "num_range": 10000000, "upper_bound": "0"}, {"distinct_range": 5000000, "num_eq": 822904469231141858, "num_range": 5000000, "upper_bound": "4"}, {"distinct_range": 3557312543.7897635, "num_eq": 8000000000, "num_range": 4000000000, "upper_bound": "e"}], "histo_col_type": "CHAR", "name": "__auto__", "null_count": 327, "row_count": 400}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 129, "histo_col_type": "", "name": "__auto__", "null_count": 332, "row_count": 400}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 225, "histo_buckets": [{"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "\\\\x"}, {"distinct_range": 8911076806247577000, "num_eq": 5476600978314083656, "num_range": 8911076806247576579, "upper_bound": "\\\\xe779fb234291e60d"}, {"distinct_range": 0, "num_eq": 3125872349580021018, "num_range": 200000, "upper_bound": "\\\\xf6c70061713e7b"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 32, "row_count": 400}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 51, "histo_col_type": "", "name": "__auto__", "null_count": 187, "row_count": 400}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 243, "histo_buckets": [{"distinct_range": 0, "num_eq": 4196825852713366344, "num_range": 0, "upper_bound": "Q"}, {"distinct_range": 0, "num_eq": 4930631294651962419, "num_range": 0, "upper_bound": "hD{3w7"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 302, "row_count": 400}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8, "histo_buckets": [{"distinct_range": 0, "num_eq": 50000000000, "num_range": 0, "upper_bound": "^\\"C\\u0016))4QG"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 236, "row_count": 400}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 395, "histo_buckets": [{"distinct_range": 0, "num_eq": 4301987269955058894, "num_range": 0, "upper_bound": "\\\\x42fd1055400000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 0, "num_eq": 70, "num_range": 700, "upper_bound": "\\\\x42fd1140000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 22554372.391197126, "num_eq": 70000000, "num_range": 30000000, "upper_bound": "\\\\x42fd11aab00000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 7031.473377896965, "num_eq": 60000000, "num_range": 9000, "upper_bound": "\\\\x42fd1300000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 70000000000, "num_eq": 50000, "num_range": 70000000000, "upper_bound": "\\\\x42fd1500000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 0, "num_eq": 20000, "num_range": 200000000, "upper_bound": "\\\\x42fd1670000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 968397758659328800, "num_eq": 10000000000, "num_range": 5560309578022880432, "upper_bound": "\\\\x42fd16c0000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 70, "num_eq": 7000000000, "num_range": 70, "upper_bound": "\\\\x42fd2c0000000000000000c002cf0ba755918cbff911016cff5fd0400027cd724686ff3fe170c7ce394541"}, {"distinct_range": 0, "num_eq": 0, "num_range": 1854525620768148609, "upper_bound": "\\\\x42fd340000000000000000c002cf0ba755918cbff911016cff5fd0400027cd724686ff3fe170c7ce394541"}, {"distinct_range": 0, "num_eq": 7302839931785473599, "num_range": 30000000, "upper_bound": "\\\\x42fd4070000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 2538798066862844400, "num_eq": 1000, "num_range": 2538798066862844436, "upper_bound": "\\\\x42fd409e1267d2972de500bff6f1051b1253c7bff0d8d85fc428403fe0da126e3267693fe6f38dc76fafba"}, {"distinct_range": 1000000000, "num_eq": 139599722992064320, "num_range": 1000000000, "upper_bound": "\\\\x42fd85731fa1093d7e9d00bffa7247f9c10f65bff3b9fbcf281cedbfdc2fa37cdf55523fc2fb100cac100f"}, {"distinct_range": 0, "num_eq": 90, "num_range": 100, "upper_bound": "\\\\x42fd9ffc00000000000000c002cf0ba755918cbff911016cff5fd0400027cd724686ff3fe170c7ce394541"}, {"distinct_range": 900, "num_eq": 40000, "num_range": 900, "upper_bound": "\\\\x42fdb00000000000000000c002cf0ba755918cbff911016cff5fd0400027cd724686ff3fe170c7ce394541"}, {"distinct_range": 0, "num_eq": 1000, "num_range": 800, "upper_bound": "\\\\x42fdba36e050693f89ff00bffa7247f9c10f65bff3b9fbcf281cedbfdc2fa37cdf55523fc2fb100cac100f"}, {"distinct_range": 0, "num_eq": 1964522557463829195, "num_range": 3000, "upper_bound": "\\\\x42fdba9ac09864d1639b01bfd1ac33a9fb502fbff6f4c89f8276bc"}, {"distinct_range": 0, "num_eq": 3196082204379599218, "num_range": 4549831417401426756, "upper_bound": "\\\\x42fdbcc1ab22eb30e7a300bff6f1051b1253c7bff0d8d85fc428403fe0da126e3267693fe6f38dc76fafba"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 0, "row_count": 400}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 248, "histo_col_type": "", "name": "__auto__", "null_count": 102, "row_count": 400}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 259, "histo_col_type": "", "name": "__auto__", "null_count": 196, "row_count": 400}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 361, "histo_col_type": "", "name": "__auto__", "null_count": 292, "row_count": 400}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS '[{"columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 22094, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 141283, "histo_col_type": "", "name": "__auto__", "null_count": 166409, "row_count": 1000000}, {"columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 254661, "histo_col_type": "", "name": "__auto__", "null_count": 485071, "row_count": 1000000}, {"columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 362206, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 162358, "histo_col_type": "", "name": "__auto__", "null_count": 261923, "row_count": 1000000}, {"columns": ["col3_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 902954, "histo_col_type": "", "name": "__auto__", "null_count": 83067, "row_count": 1000000}, {"columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 147772, "histo_col_type": "", "name": "__auto__", "null_count": 440473, "row_count": 1000000}, {"columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 405292, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 54774, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 322143, "histo_col_type": "", "name": "__auto__", "null_count": 348046, "row_count": 1000000}, {"columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 799493, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 653554, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 61652, "histo_col_type": "", "name": "__auto__", "null_count": 756354, "row_count": 1000000}, {"columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 865211, "histo_col_type": "", "name": "__auto__", "null_count": 597256, "row_count": 1000000}, {"columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 403106, "histo_col_type": "", "name": "__auto__", "null_count": 789536, "row_count": 1000000}, {"columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 796954, "histo_col_type": "", "name": "__auto__", "null_count": 377227, "row_count": 1000000}, {"columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 90927, "histo_col_type": "", "name": "__auto__", "null_count": 85370, "row_count": 1000000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('t', 'tbhcl', 'ndgb', 'jaf', 'wu');
        CREATE TYPE rand_typ_1 AS ENUM ('wtary', 'egf', 'uabb', 'rvue');
        CREATE TYPE rand_typ_2 AS ENUM ('kff', 'zp', 'm', 'o', 'dibmyq', 'vbrwkz');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith147610830
--- FAIL: TestRandomSyntaxSQLSmith (300.59s)
Reproduce

To reproduce, try:

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

Internal log

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

/cc @rafiss

This test on roachdash | Improve this report!

@rafiss
Copy link
Collaborator

rafiss commented Apr 18, 2021

The latest failure is caused by this query:

        WITH
                with_164457 (col_959332)
                        AS (
                                SELECT
                                        1657574834394208055:::INT8 AS col_959332
                                FROM
                                        defaultdb.public.seed@seed__int8__float8__date_idx AS tab_401952,
                                        defaultdb.public.table1@table1_col1_8_col1_2_col1_3_col1_5_col1_1_key AS tab_401953
                                        JOIN defaultdb.public.table3@[0] AS tab_401954
                                                JOIN defaultdb.public.table2@[0] AS tab_401955 ON (tab_401954.col3_2) = (tab_401955.col2_9)
                                                JOIN defaultdb.public.seed@seed__int8__float8__date_idx AS tab_401956
                                                        JOIN defaultdb.public.table1@table1_col1_4_col1_3_col1_7_col1_2_col1_6_col1_1_col1_5_idx
                                                                        AS tab_401957
                                                                JOIN defaultdb.public.table2@table2_col2_4_col2_6_col2_5_idx AS tab_401958
                                                                        JOIN defaultdb.public.seed@[0] AS tab_401959 ON
                                                                                        (tab_401958.col2_9) = (tab_401959._string)
                                                                                        AND (tab_401958.col2_8) = (tab_401959._string) ON
                                                                                (tab_401957.col1_1) = (tab_401959._bool)
                                                                JOIN defaultdb.public.table2@table2_col2_7_idx AS tab_401960 ON
                                                                                (tab_401957.col1_8) = (tab_401960.col2_6) ON
                                                                        (tab_401956._int8) = (tab_401959._int4) ON
                                                                (tab_401955.col2_6) = (tab_401960.col2_6) AND (tab_401955.col2_7) = (tab_401960.col2_9) ON
                                                        (tab_401953.col1_7) = (tab_401955.col2_5) AND (tab_401953.col1_3) = (tab_401956._int2)
                                        JOIN defaultdb.public.table2@[0] AS tab_401961 ON
                                                        (tab_401956.tableoid) = (tab_401961.tableoid)
                                                        AND (tab_401960.col2_0) = (tab_401961.col2_9)
                                                        AND (tab_401954.col3_4) = (tab_401961.col2_9)
                                                        AND (tab_401955.col2_0) = (tab_401961.col2_9)
                                        JOIN defaultdb.public.seed@[0] AS tab_401962 ON
                                                        (tab_401953.col1_5) = (tab_401962._date)
                                                        AND (tab_401954.col3_3) = (tab_401962._string)
                                                        AND (tab_401954.col3_2) = (tab_401962._string)
                                WHERE
                                        tab_401962._bool
                        )
        SELECT
                cte_ref_47303.col_959332 AS col_959333
        FROM
                with_164457 AS cte_ref_47303
        WHERE
                true
        LIMIT
                86:::INT8;

It caused this server panic:

 server panic: pq: internal error: ordering column group (58,141) contains non-equivalent columns (op inner-join)

And these logs

E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1  encountered internal error:
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +ordering column group (58,141) contains non-equivalent columns (
op inner-join)
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +(1) assertion failure
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +Wraps: (2) attached stack trace
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  -- stack trace:
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  | github.com/cockroachdb/cockroach/pkg/sql/opt/ordering.checkR
equired
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  |     /go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/ord
ering/ordering.go:361
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  | github.com/cockroachdb/cockroach/pkg/sql/opt/ordering.BuildC
hildRequired
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  |     /go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/ord
ering/ordering.go:43
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  | github.com/cockroachdb/cockroach/pkg/sql/opt/xform.BuildChil
dPhysicalProps
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  |     /go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/xfo
rm/physical_props.go:80
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  | github.com/cockroachdb/cockroach/pkg/sql/opt/xform.(*Optimiz
er).optimizeGroupMember
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  |     /go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/xfo
rm/optimizer.go:503
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  | github.com/cockroachdb/cockroach/pkg/sql/opt/xform.(*Optimiz
er).optimizeGroup
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  |     /go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/xfo
rm/optimizer.go:451
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  | github.com/cockroachdb/cockroach/pkg/sql/opt/xform.(*Optimiz
er).optimizeExpr
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  |     /go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/xfo
rm/optimizer.go:251
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  | github.com/cockroachdb/cockroach/pkg/sql/opt/xform.(*Optimiz
er).optimizeGroupMember
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  |     /go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/xfo
rm/optimizer.go:506
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  | github.com/cockroachdb/cockroach/pkg/sql/opt/xform.(*Optimiz
er).optimizeGroup
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  |     /go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/xfo
rm/optimizer.go:451
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  | github.com/cockroachdb/cockroach/pkg/sql/opt/xform.(*Optimiz
er).optimizeExpr
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  |     /go/src/github.com/cockroachdb/cockroach/pkg/sql/opt/xfo
rm/optimizer.go:251
E210417 18:51:41.306302 9248606 sql/sqltelemetry/report.go:57  [n1,client=127.0.0.1:44294,hostssl,user=root] 1 +  | github.com/cockroachdb/cockroach/pkg/sql/opt/xform.(*Optimiz
er).optimizeGroupMember

This is the schema
sqlsmith-schema.sql.txt

However, when I tried to reproduce locally, I instead got a handled error instead of a panic

ERROR: index "table1_col1_4_col1_3_col1_7_col1_2_col1_6_col1_1_col1_5_idx" is a partial index that does not contain all the rows needed to execute this query

cc @rytaft -- i'll put this on the SQL Queries board for further triage

@rytaft
Copy link
Collaborator

rytaft commented Apr 19, 2021

Thanks, @rafiss! I can reproduce locally using a logictest (the assertion is only triggered in test builds):

statement ok
CREATE TABLE table1 (col1_0 BIT(8) NOT NULL, col1_1 BOOL NOT NULL, col1_2 OID NOT NULL, col1_3 INT2 NOT NULL, col1_4 DECIMAL, col1_5 DATE NOT NULL, col1_6 TIMETZ NOT NULL, col1_7 UUID NOT NULL, PRIMARY KEY (col1_1 DESC, col1_0 DESC, col1_7 DESC, col1_5, col1_6 DESC, col1_3 ASC, col1_2), col1_8 STRING NOT NULL AS (lower(CAST(col1_5 AS STRING))) STORED, INDEX (col1_3 DESC, col1_1 DESC, col1_8, col1_4, col1_5, col1_2 DESC, col1_7 DESC), INDEX (col1_2 ASC, col1_1, col1_3, col1_7 DESC, col1_6) WHERE ((((table1.col1_4 >= '-Infinity':::DECIMAL) AND (table1.col1_6 >= '24:00:00-15:59:00':::TIMETZ)) OR (table1.col1_8 <= '':::STRING)) OR (table1.col1_5 < '4714-11-24 BC':::DATE)) OR (table1.col1_3 < 32767:::INT8), UNIQUE (col1_8, col1_2 DESC, col1_3 ASC, col1_5 DESC, col1_1 DESC), INDEX (col1_2, col1_5), UNIQUE (col1_1, col1_4 ASC, col1_3 DESC, col1_6, col1_5 ASC, col1_7 ASC, col1_8 DESC, col1_2) WHERE (table1.col1_4 >= 1:::DECIMAL) AND (table1.col1_5 >= '5874897-12-31':::DATE), INDEX (col1_3 ASC, col1_0 ASC, col1_5 ASC) STORING (col1_8) WHERE table1.col1_1 AND (table1.col1_3 > 1:::INT8), INDEX (col1_6, col1_3 ASC) STORING (col1_4, col1_8), INDEX (col1_2, col1_7, col1_8 ASC, col1_0 DESC, col1_3, col1_6 ASC, col1_1, col1_4 ASC) WHERE (table1.col1_6 = '00:00:00+15:59:00':::TIMETZ) AND (table1.col1_5 >= '4714-11-24 BC':::DATE), INDEX (col1_4, col1_3 DESC, col1_7 ASC, col1_2 DESC, col1_6 ASC, col1_1 ASC, col1_5 DESC) WHERE (((((table1.col1_6 >= '24:00:00-15:59:00':::TIMETZ) AND (table1.col1_4 < (-1):::DECIMAL)) OR (table1.col1_8 != e'\U00002603':::STRING)) OR (table1.col1_3 = 1:::INT8)) AND (NOT table1.col1_1)) OR (table1.col1_5 > '1970-01-01':::DATE));
CREATE TABLE table2 (col2_0 CHAR NULL, col2_1 GEOMETRY NULL, col2_2 GEOGRAPHY NOT NULL, col2_3 REGTYPE, col2_4 BYTES, col2_5 UUID, col2_6 STRING AS (CASE WHEN col2_4 IS NULL THEN 'N':::STRING ELSE '':::STRING END) STORED, col2_7 STRING NULL AS (lower(col2_0)) STORED, col2_8 STRING AS (CASE WHEN col2_4 IS NULL THEN 'r':::STRING ELSE e'*6\x16':::STRING END) VIRTUAL, col2_9 STRING NULL AS (lower(col2_0)) VIRTUAL, INDEX (col2_4 ASC, col2_8 ASC), INVERTED INDEX (col2_2 DESC) WHERE table2.col2_6 = '"':::STRING, INDEX (col2_7 DESC) STORING (col2_0, col2_2, col2_4), INVERTED INDEX (col2_9 ASC, col2_7 DESC, col2_0, col2_6 ASC, col2_8 ASC, col2_4 ASC, col2_3 DESC, col2_2 ASC), INDEX (col2_4 DESC, col2_6 DESC, col2_5 ASC) STORING (col2_2), UNIQUE (col2_0 DESC, col2_8 DESC, col2_3 ASC, col2_4 DESC, col2_6 DESC) WHERE (((((table2.col2_8 >= e'\x00':::STRING) AND (table2.col2_7 >= '':::STRING)) AND (table2.col2_4 >= '\x00':::BYTES)) OR (table2.col2_0 > e'\x00':::STRING)) AND (table2.col2_6 >= '':::STRING)) AND (table2.col2_9 < e'\x00':::STRING), FAMILY (col2_6, col2_2, col2_7), FAMILY (col2_1), FAMILY (col2_3, col2_0, col2_4, col2_5));
CREATE TABLE table3 (col3_0 INT2, col3_1 TIMESTAMPTZ NOT NULL, col3_2 CHAR NOT NULL, col3_3 VARCHAR NULL, col3_4 VARCHAR, col3_5 FLOAT8 NOT NULL, col3_6 REGPROCEDURE, col3_7 GEOGRAPHY, col3_8 OID, col3_9 STRING NULL, col3_10 TIMESTAMP, col3_11 REGPROC, col3_12 INT4 NOT NULL, col3_13 GEOGRAPHY NOT NULL, col3_14 INT8 NOT NULL, PRIMARY KEY (col3_5 DESC, col3_1), col3_15 INT4 AS (col3_12 + col3_14) VIRTUAL, col3_16 STRING AS (lower(CAST(col3_10 AS STRING))) STORED, FAMILY (col3_13), FAMILY (col3_4, col3_11), FAMILY (col3_10), FAMILY (col3_14), FAMILY (col3_16), FAMILY (col3_3), FAMILY (col3_8), FAMILY (col3_9), FAMILY (col3_12), FAMILY (col3_1, col3_5, col3_2), FAMILY (col3_6, col3_0, col3_7));
ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3432, "histo_buckets": [{"distinct_range": 0, "num_eq": 40, "num_range": 0, "upper_bound": "-8071"}, {"distinct_range": 2860087433997913600, "num_eq": 2000, "num_range": 3620502857012601441, "upper_bound": "20975"}, {"distinct_range": 42177026013971090, "num_eq": 10000000, "num_range": 8334082438522879528, "upper_bound": "30394"}], "histo_col_type": "INT2", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6855, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1800, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4832, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2689, "histo_buckets": [{"distinct_range": 0, "num_eq": 2984197463322861850, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 0, "num_eq": 4000, "num_range": 30000000, "upper_bound": "70558795"}, {"distinct_range": 2957763307794631700, "num_eq": 90, "num_range": 8758359606310102970, "upper_bound": "949975026"}, {"distinct_range": 0, "num_eq": 30000, "num_range": 200, "upper_bound": "956195559"}, {"distinct_range": 0, "num_eq": 0, "num_range": 8000, "upper_bound": "1138404297"}, {"distinct_range": 0, "num_eq": 1454661804234915163, "num_range": 553714627610241724, "upper_bound": "2343731445"}, {"distinct_range": 0, "num_eq": 80, "num_range": 7025245110284449105, "upper_bound": "3035680172"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3161, "histo_buckets": [{"distinct_range": 0, "num_eq": 8209733581151198445, "num_range": 0, "upper_bound": "296489376.047037284"}, {"distinct_range": 366230214557651000, "num_eq": 8503033353814028224, "num_range": 2911033028846665436, "upper_bound": "140281176305039710.9"}, {"distinct_range": 8000000, "num_eq": 6000000, "num_range": 8000000, "upper_bound": "5.172379502231524589E+25"}, {"distinct_range": 0, "num_eq": 300000000, "num_range": 2097417642109105357, "upper_bound": "7.448615333637386959E+29"}], "histo_col_type": "DECIMAL", "name": "__auto__", "null_count": 4823, "row_count": 10000}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3155, "histo_buckets": [{"distinct_range": 0, "num_eq": 6701423377587903499, "num_range": 0, "upper_bound": "12:25:38.232838+07:26:00"}, {"distinct_range": 6727037721699796000, "num_eq": 50, "num_range": 6727037721699796010, "upper_bound": "15:48:11.367139+02:06:00"}, {"distinct_range": 5289204294334514000, "num_eq": 8451568146588816887, "num_range": 5824260813763934298, "upper_bound": "07:25:56.16758-12:03:00"}, {"distinct_range": 2152779800286133000, "num_eq": 8042073515934645456, "num_range": 2152779800286132904, "upper_bound": "24:00:00-15:59:00"}], "histo_col_type": "TIMETZ", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4609, "histo_buckets": [{"distinct_range": 0, "num_eq": 800000, "num_range": 0, "upper_bound": "2\\u000e2\\u0018v\\u001b\\u0019sL"}, {"distinct_range": 831530482228560300, "num_eq": 50000000000, "num_range": 831530482228560244, "upper_bound": "d=f"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 10000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1283, "histo_buckets": [{"distinct_range": 0, "num_eq": 50000000000, "num_range": 0, "upper_bound": "false"}, {"distinct_range": 2115847429150123800, "num_eq": 1755197066118375064, "num_range": 2115847429150123720, "upper_bound": "true"}], "histo_col_type": "BOOL", "name": "__auto__", "null_count": 0, "row_count": 10000}]':::JSONB;
ALTER TABLE table2 INJECT STATISTICS e'[{"columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 347, "histo_buckets": [{"distinct_range": 0, "num_eq": 1645840271581996351, "num_range": 0, "upper_bound": "\\u0006"}, {"distinct_range": 10000000, "num_eq": 9000000, "num_range": 10000000, "upper_bound": "0"}, {"distinct_range": 5000000, "num_eq": 822904469231141858, "num_range": 5000000, "upper_bound": "4"}, {"distinct_range": 3557312543.7897635, "num_eq": 8000000000, "num_range": 4000000000, "upper_bound": "e"}], "histo_col_type": "CHAR", "name": "__auto__", "null_count": 327, "row_count": 400}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 129, "histo_col_type": "", "name": "__auto__", "null_count": 332, "row_count": 400}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 225, "histo_buckets": [{"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "\\\\x"}, {"distinct_range": 8911076806247577000, "num_eq": 5476600978314083656, "num_range": 8911076806247576579, "upper_bound": "\\\\xe779fb234291e60d"}, {"distinct_range": 0, "num_eq": 3125872349580021018, "num_range": 200000, "upper_bound": "\\\\xf6c70061713e7b"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 32, "row_count": 400}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 51, "histo_col_type": "", "name": "__auto__", "null_count": 187, "row_count": 400}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 243, "histo_buckets": [{"distinct_range": 0, "num_eq": 4196825852713366344, "num_range": 0, "upper_bound": "Q"}, {"distinct_range": 0, "num_eq": 4930631294651962419, "num_range": 0, "upper_bound": "hD{3w7"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 302, "row_count": 400}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8, "histo_buckets": [{"distinct_range": 0, "num_eq": 50000000000, "num_range": 0, "upper_bound": "^\\"C\\u0016))4QG"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 236, "row_count": 400}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 395, "histo_buckets": [{"distinct_range": 0, "num_eq": 4301987269955058894, "num_range": 0, "upper_bound": "\\\\x42fd1055400000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 0, "num_eq": 70, "num_range": 700, "upper_bound": "\\\\x42fd1140000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 22554372.391197126, "num_eq": 70000000, "num_range": 30000000, "upper_bound": "\\\\x42fd11aab00000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 7031.473377896965, "num_eq": 60000000, "num_range": 9000, "upper_bound": "\\\\x42fd1300000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 70000000000, "num_eq": 50000, "num_range": 70000000000, "upper_bound": "\\\\x42fd1500000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 0, "num_eq": 20000, "num_range": 200000000, "upper_bound": "\\\\x42fd1670000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 968397758659328800, "num_eq": 10000000000, "num_range": 5560309578022880432, "upper_bound": "\\\\x42fd16c0000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 70, "num_eq": 7000000000, "num_range": 70, "upper_bound": "\\\\x42fd2c0000000000000000c002cf0ba755918cbff911016cff5fd0400027cd724686ff3fe170c7ce394541"}, {"distinct_range": 0, "num_eq": 0, "num_range": 1854525620768148609, "upper_bound": "\\\\x42fd340000000000000000c002cf0ba755918cbff911016cff5fd0400027cd724686ff3fe170c7ce394541"}, {"distinct_range": 0, "num_eq": 7302839931785473599, "num_range": 30000000, "upper_bound": "\\\\x42fd4070000000000000003fc657184ae744853fc657184ae744763fe657184ae744863fe657184ae7448a"}, {"distinct_range": 2538798066862844400, "num_eq": 1000, "num_range": 2538798066862844436, "upper_bound": "\\\\x42fd409e1267d2972de500bff6f1051b1253c7bff0d8d85fc428403fe0da126e3267693fe6f38dc76fafba"}, {"distinct_range": 1000000000, "num_eq": 139599722992064320, "num_range": 1000000000, "upper_bound": "\\\\x42fd85731fa1093d7e9d00bffa7247f9c10f65bff3b9fbcf281cedbfdc2fa37cdf55523fc2fb100cac100f"}, {"distinct_range": 0, "num_eq": 90, "num_range": 100, "upper_bound": "\\\\x42fd9ffc00000000000000c002cf0ba755918cbff911016cff5fd0400027cd724686ff3fe170c7ce394541"}, {"distinct_range": 900, "num_eq": 40000, "num_range": 900, "upper_bound": "\\\\x42fdb00000000000000000c002cf0ba755918cbff911016cff5fd0400027cd724686ff3fe170c7ce394541"}, {"distinct_range": 0, "num_eq": 1000, "num_range": 800, "upper_bound": "\\\\x42fdba36e050693f89ff00bffa7247f9c10f65bff3b9fbcf281cedbfdc2fa37cdf55523fc2fb100cac100f"}, {"distinct_range": 0, "num_eq": 1964522557463829195, "num_range": 3000, "upper_bound": "\\\\x42fdba9ac09864d1639b01bfd1ac33a9fb502fbff6f4c89f8276bc"}, {"distinct_range": 0, "num_eq": 3196082204379599218, "num_range": 4549831417401426756, "upper_bound": "\\\\x42fdbcc1ab22eb30e7a300bff6f1051b1253c7bff0d8d85fc428403fe0da126e3267693fe6f38dc76fafba"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 0, "row_count": 400}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 248, "histo_col_type": "", "name": "__auto__", "null_count": 102, "row_count": 400}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 259, "histo_col_type": "", "name": "__auto__", "null_count": 196, "row_count": 400}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 361, "histo_col_type": "", "name": "__auto__", "null_count": 292, "row_count": 400}]':::JSONB;
ALTER TABLE table3 INJECT STATISTICS '[{"columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 22094, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 141283, "histo_col_type": "", "name": "__auto__", "null_count": 166409, "row_count": 1000000}, {"columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 254661, "histo_col_type": "", "name": "__auto__", "null_count": 485071, "row_count": 1000000}, {"columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 362206, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 162358, "histo_col_type": "", "name": "__auto__", "null_count": 261923, "row_count": 1000000}, {"columns": ["col3_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 902954, "histo_col_type": "", "name": "__auto__", "null_count": 83067, "row_count": 1000000}, {"columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 147772, "histo_col_type": "", "name": "__auto__", "null_count": 440473, "row_count": 1000000}, {"columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 405292, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 54774, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 322143, "histo_col_type": "", "name": "__auto__", "null_count": 348046, "row_count": 1000000}, {"columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 799493, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 653554, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000}, {"columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 61652, "histo_col_type": "", "name": "__auto__", "null_count": 756354, "row_count": 1000000}, {"columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 865211, "histo_col_type": "", "name": "__auto__", "null_count": 597256, "row_count": 1000000}, {"columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 403106, "histo_col_type": "", "name": "__auto__", "null_count": 789536, "row_count": 1000000}, {"columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 796954, "histo_col_type": "", "name": "__auto__", "null_count": 377227, "row_count": 1000000}, {"columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 90927, "histo_col_type": "", "name": "__auto__", "null_count": 85370, "row_count": 1000000}]':::JSONB;
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);

statement ok
WITH
        	with_164457 (col_959332)
        		AS (
        			SELECT
        				1657574834394208055:::INT8 AS col_959332
        			FROM
        				seed@seed__int8__float8__date_idx AS tab_401952,
        				table1@table1_col1_8_col1_2_col1_3_col1_5_col1_1_key AS tab_401953
        				JOIN table3@[0] AS tab_401954
        					JOIN table2@[0] AS tab_401955 ON (tab_401954.col3_2) = (tab_401955.col2_9)
        					JOIN seed@seed__int8__float8__date_idx AS tab_401956
        						JOIN table1@table1_col1_4_col1_3_col1_7_col1_2_col1_6_col1_1_col1_5_idx
        								AS tab_401957
        							JOIN table2@table2_col2_4_col2_6_col2_5_idx AS tab_401958
        								JOIN seed@[0] AS tab_401959 ON
        										(tab_401958.col2_9) = (tab_401959._string)
        										AND (tab_401958.col2_8) = (tab_401959._string) ON
        									(tab_401957.col1_1) = (tab_401959._bool)
        							JOIN table2@table2_col2_7_idx AS tab_401960 ON
        									(tab_401957.col1_8) = (tab_401960.col2_6) ON
        								(tab_401956._int8) = (tab_401959._int4) ON
        							(tab_401955.col2_6) = (tab_401960.col2_6) AND (tab_401955.col2_7) = (tab_401960.col2_9) ON
        						(tab_401953.col1_7) = (tab_401955.col2_5) AND (tab_401953.col1_3) = (tab_401956._int2)
        				JOIN table2@[0] AS tab_401961 ON
        						(tab_401956.tableoid) = (tab_401961.tableoid)
        						AND (tab_401960.col2_0) = (tab_401961.col2_9)
        						AND (tab_401954.col3_4) = (tab_401961.col2_9)
        						AND (tab_401955.col2_0) = (tab_401961.col2_9)
        				JOIN seed@[0] AS tab_401962 ON
        						(tab_401953.col1_5) = (tab_401962._date)
        						AND (tab_401954.col3_3) = (tab_401962._string)
        						AND (tab_401954.col3_2) = (tab_401962._string)
        			WHERE
        				tab_401962._bool
        		)
        SELECT
        	cte_ref_47303.col_959332 AS col_959333
        FROM
        	with_164457 AS cte_ref_47303
        WHERE
        	true
        LIMIT
        	86:::INT8;

@cockroach-teamcity
Copy link
Member Author

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

        
        		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 OID NOT NULL, col1_1 REGPROC NULL, col1_2 INT8 NOT NULL, col1_3 INT2, col1_4 INT2 NULL, col1_5 BYTES NOT NULL, col1_6 BIT(27), col1_7 INT4, col1_8 "char" NOT NULL, col1_9 INT4 NOT NULL, PRIMARY KEY (col1_2 ASC, col1_8 ASC), col1_10 STRING AS (lower(CAST(col1_6 AS STRING))) STORED, col1_11 INT8 NOT NULL AS (col1_2 + col1_9) VIRTUAL, col1_12 INT2 AS ((col1_3 + col1_7) + col1_2) VIRTUAL, col1_13 INT4 AS (col1_9 + col1_3) VIRTUAL, col1_14 INT8 AS (col1_2 + col1_7) STORED, col1_15 INT2 NULL AS (col1_4 + col1_2) VIRTUAL, col1_16 INT2 NULL AS ((col1_4 + col1_2) + col1_9) VIRTUAL, col1_17 INT4 AS (((col1_9 + col1_3) + col1_4) + col1_7) STORED, UNIQUE (col1_9 ASC, col1_11, col1_3, col1_17 ASC, col1_14, col1_4, col1_15 DESC, col1_5 DESC, col1_16, col1_12, col1_8 ASC, col1_7 ASC, col1_2, col1_0), FAMILY (col1_6, col1_0), FAMILY (col1_2, col1_9), FAMILY (col1_10), FAMILY (col1_17, col1_1), FAMILY (col1_4, col1_14), FAMILY (col1_5), FAMILY (col1_3, col1_7, col1_8));
        CREATE TABLE table2 (col1_2 INT8 NOT NULL, col1_8 "char" NOT NULL, col2_2 INT8 NOT NULL, col2_3 INT4, col2_4 REGNAMESPACE, col2_5 INTERVAL NOT NULL, col2_6 INET, col2_7 VARCHAR NULL, col2_8 INET NOT NULL, col2_9 TIMESTAMP, col2_10 INT8 NULL, col2_11 VARCHAR NULL, PRIMARY KEY (col1_2 ASC, col1_8 ASC, col2_7 DESC, col2_10, col2_5 ASC, col2_2, col2_6 ASC, col2_3, col2_8, col2_4 DESC), INDEX (col2_5 ASC, col2_8 ASC, col2_9 DESC, col2_10, col2_4 ASC, col2_11, col1_2, col2_6 DESC, col1_8 DESC, col2_3, col2_2, col2_7 ASC), INDEX (col2_9 DESC, col2_5 ASC, col2_7 ASC, col1_2, col2_6 DESC, col2_8 ASC) WHERE table2.col1_8 > e'\U00002603':::STRING, UNIQUE (col2_5, col2_2 ASC, col2_7 DESC, col2_4 DESC, col2_9, col2_3 ASC, col2_8 DESC, col1_8 ASC, col2_10) STORING (col2_11)) INTERLEAVE IN PARENT table1 (col1_2, col1_8);
        CREATE TABLE table3 (col1_2 INT8 NOT NULL, col1_8 "char" NOT NULL, col2_7 VARCHAR NULL, col2_10 INT8 NULL, col2_5 INTERVAL NOT NULL, col2_2 INT8 NOT NULL, col2_6 INET, col2_3 INT4, col2_8 INET NOT NULL, col2_4 REGNAMESPACE, col3_10 REGTYPE NULL, col3_11 FLOAT8 NOT NULL, col3_12 VARCHAR, col3_13 REGPROC NULL, col3_14 REGPROCEDURE NULL, col3_15 VARCHAR NULL, col3_16 TIMESTAMPTZ NULL, col3_17 STRING NULL, col3_18 BOOL NULL, col3_19 INT4, col3_20 BIT, col3_21 STRING NOT NULL, col3_22 NAME NOT NULL, col3_23 REGPROC NULL, col3_24 INET, col3_25 TIMETZ, col3_26 BIT(12) NOT NULL, col3_27 REGPROC NOT NULL, PRIMARY KEY (col1_2 ASC, col1_8 ASC, col2_7 DESC, col2_10, col2_5 ASC, col2_2, col2_6 ASC, col2_3, col2_8, col2_4 DESC, col3_26 ASC, col3_15 ASC, col3_13 ASC, col3_20 ASC, col3_18 DESC, col3_10, col3_14 ASC), UNIQUE (col3_16 DESC, col2_8 ASC, col3_20 ASC, col2_7 DESC, col2_3 ASC, col3_21, col3_18 ASC, col3_26 ASC, col3_12 ASC, col3_19, col3_11 DESC, col3_10 ASC, col1_2 DESC, col2_6 ASC, col3_13 ASC, col1_8 DESC, col3_25 DESC, col2_4 ASC, col2_10, col3_22 DESC, col3_27 ASC, col3_14 ASC, col2_2 ASC, col3_15, col3_23 DESC, col3_24 DESC) STORING (col3_17), UNIQUE (col2_3, col1_8 DESC, col2_8 ASC, col3_25) WHERE ((((((((((((((table3.col3_25 <= '24:00:00-15:59:00':::TIMETZ) OR table3.col3_18) OR (table3.col3_15 <= e'\'':::STRING)) AND (table3.col3_19 != 1:::INT8)) OR (table3.col3_16 >= '-2000-01-01 00:00:00+00:00':::TIMESTAMPTZ)) OR (table3.col3_22 > e'\'':::STRING)) AND (table3.col2_7 <= e'\'':::STRING)) OR (table3.col3_21 < e'\x00':::STRING)) OR (table3.col2_10 >= 32767:::INT8)) OR (table3.col3_11 = '-Inf':::FLOAT8)) AND (table3.col3_17 < e'\U00002603':::STRING)) OR (table3.col1_2 <= (-9223372036854775807):::INT8)) OR (table3.col3_12 < '':::STRING)) OR (table3.col2_2 < (-2147483648):::INT8)) AND (table3.col1_8 < 'X':::STRING), UNIQUE (col1_2 DESC, col3_22, col3_17 ASC, col2_10, col3_14 DESC, col3_26 ASC, col3_24, col2_5 ASC, col2_3 ASC, col3_21 DESC, col2_6 DESC, col3_12 ASC, col3_25 ASC, col3_10, col2_7 DESC, col2_2, col3_20 DESC) WHERE ((((((((table3.col1_8 <= e'\'':::STRING) OR (table3.col3_12 <= 'X':::STRING)) AND (table3.col3_11 <= 3.4028234663852886e+38:::FLOAT8)) AND (table3.col2_7 >= '"':::STRING)) OR (table3.col3_17 >= 'X':::STRING)) OR (table3.col3_22 > 'X':::STRING)) OR (table3.col3_21 != 'X':::STRING)) OR (table3.col3_25 > '24:00:00-15:59:00':::TIMETZ)) OR (table3.col2_2 >= 2147483647:::INT8)) INTERLEAVE IN PARENT table2 (col1_2, col1_8, col2_7, col2_10, col2_5, col2_2, col2_6, col2_3, col2_8, col2_4);
        ALTER TABLE table1 INJECT STATISTICS '[{"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 181626731, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000000}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 127680823, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000000}, {"columns": ["col1_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 811995017, "histo_col_type": "", "name": "__auto__", "null_count": 711244886, "row_count": 1000000000}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 149323360, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000000}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 47607937, "histo_col_type": "", "name": "__auto__", "null_count": 995846537, "row_count": 1000000000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 578587002, "histo_col_type": "", "name": "__auto__", "null_count": 212885678, "row_count": 1000000000}, {"columns": ["col1_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 704216804, "histo_col_type": "", "name": "__auto__", "null_count": 2728855, "row_count": 1000000000}, {"columns": ["col1_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 421046188, "histo_col_type": "", "name": "__auto__", "null_count": 22680857, "row_count": 1000000000}, {"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 154146937, "histo_col_type": "", "name": "__auto__", "null_count": 806800495, "row_count": 1000000000}, {"columns": ["col1_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 691637857, "histo_col_type": "", "name": "__auto__", "null_count": 466339173, "row_count": 1000000000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 824163995, "histo_col_type": "", "name": "__auto__", "null_count": 698357254, "row_count": 1000000000}, {"columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 897482526, "histo_buckets": [{"distinct_range": 0, "num_eq": 40000000000, "num_range": 0, "upper_bound": "-574494068"}, {"distinct_range": 80, "num_eq": 0, "num_range": 80, "upper_bound": "309466892"}, {"distinct_range": 0, "num_eq": 30, "num_range": 20000000000, "upper_bound": "848694138"}, {"distinct_range": 154883.8417842628, "num_eq": 60, "num_range": 900000, "upper_bound": "1072884478"}, {"distinct_range": 20000000000, "num_eq": 1341796229309853668, "num_range": 20000000000, "upper_bound": "1865879333"}], "histo_col_type": "INT4", "name": "__auto__", "null_count": 0, "row_count": 1000000000}, {"columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 80362765, "histo_col_type": "", "name": "__auto__", "null_count": 224984616, "row_count": 1000000000}, {"columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 583278768, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000000}, {"columns": ["col1_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 867878943, "histo_col_type": "", "name": "__auto__", "null_count": 612914556, "row_count": 1000000000}, {"columns": ["col1_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 998668215, "histo_col_type": "", "name": "__auto__", "null_count": 701682141, "row_count": 1000000000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 642024799, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1000000000}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 836053162, "histo_col_type": "", "name": "__auto__", "null_count": 175251673, "row_count": 1000000000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1907826117392064781, "histo_buckets": [{"distinct_range": 0, "num_eq": 8217444705291484048, "num_range": 0, "upper_bound": "1977-12-04 05:20:41.000746"}, {"distinct_range": 4730998218642000000, "num_eq": 20000000000, "num_range": 5260390180167191892, "upper_bound": "1985-03-17 12:56:05.000253"}, {"distinct_range": 0, "num_eq": 3045078450218258543, "num_range": 100000, "upper_bound": "2002-06-15 14:54:21.000019"}, {"distinct_range": 6000000, "num_eq": 4843299481704320317, "num_range": 6000000, "upper_bound": "2023-04-09 19:10:11.000477"}, {"distinct_range": 83.70763155866726, "num_eq": 7370654585134445600, "num_range": 100, "upper_bound": "2029-07-10 10:31:02.000986"}], "histo_col_type": "TIMESTAMP", "name": "__auto__", "null_count": 771149965310542839, "row_count": 6238860057953548483}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1365882536945306212, "histo_col_type": "", "name": "__auto__", "null_count": 3469056309905264988, "row_count": 6238860057953548483}, {"columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4814459797613173961, "histo_col_type": "", "name": "__auto__", "null_count": 1099416484112037647, "row_count": 6238860057953548483}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5385018859268157906, "histo_col_type": "", "name": "__auto__", "null_count": 3390948158212927223, "row_count": 6238860057953548483}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3057773783145608139, "histo_col_type": "", "name": "__auto__", "null_count": 3974896568811954457, "row_count": 6238860057953548483}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 991614871751614002, "histo_col_type": "", "name": "__auto__", "null_count": 1019209524012844561, "row_count": 6238860057953548483}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5964711633188613332, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6238860057953548483}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 37643588155694095, "histo_col_type": "", "name": "__auto__", "null_count": 584416850801486926, "row_count": 6238860057953548483}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 257122132085780032, "histo_buckets": [{"distinct_range": 0, "num_eq": 5561434730534611467, "num_range": 0, "upper_bound": "8648167021753055081"}, {"distinct_range": 0, "num_eq": 7482494074560748666, "num_range": 1649402382706037223, "upper_bound": "8990362867117270738"}], "histo_col_type": "INT8", "name": "__auto__", "null_count": 0, "row_count": 6238860057953548483}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6165702962154195789, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6238860057953548483}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2360353127743829964, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6238860057953548483}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1009536945485517385, "histo_buckets": [{"distinct_range": 0, "num_eq": 300000, "num_range": 0, "upper_bound": "-56 years -2 mons -774 days -16:16:39.854813"}, {"distinct_range": 0, "num_eq": 1821064472208339326, "num_range": 800000000, "upper_bound": "-4 years -4 mons -437 days -08:19:33.45226"}, {"distinct_range": 337203430889178700, "num_eq": 4581256165377032492, "num_range": 2231441076429389288, "upper_bound": "42 years 4 mons 692 days 17:08:08.433041"}, {"distinct_range": 0, "num_eq": 100000, "num_range": 3092046317048164466, "upper_bound": "66 years 1 mon 409 days 07:02:08.142547"}], "histo_col_type": "INTERVAL", "name": "__auto__", "null_count": 0, "row_count": 6238860057953548483}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS '[{"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 111855792367976212, "histo_col_type": "", "name": "__auto__", "null_count": 533613668666008519, "row_count": 1532105224372420519}, {"columns": ["col3_18"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1149073373379662620, "histo_col_type": "", "name": "__auto__", "null_count": 1253795477332761991, "row_count": 1532105224372420519}, {"columns": ["col3_25"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1366750858249460311, "histo_col_type": "", "name": "__auto__", "null_count": 203678964533741491, "row_count": 1532105224372420519}, {"columns": ["col3_27"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 778438948195456827, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1532105224372420519}, {"columns": ["col3_26"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 594113996540204117, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1532105224372420519}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 434314486909376478, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1532105224372420519}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 738752880857558741, "histo_buckets": [{"distinct_range": 0, "num_eq": 8826957230972568266, "num_range": 0, "upper_bound": "-1389900667"}, {"distinct_range": 0, "num_eq": 2329653013456068892, "num_range": 6000000000, "upper_bound": "-1029120006"}, {"distinct_range": 0, "num_eq": 3558591687811193166, "num_range": 3000, "upper_bound": "1597475739"}], "histo_col_type": "INT4", "name": "__auto__", "null_count": 1206981633544962119, "row_count": 1532105224372420519}, {"columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 985546500686477451, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1532105224372420519}, {"columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 26297875031954081, "histo_col_type": "", "name": "__auto__", "null_count": 1260278373682456117, "row_count": 1532105224372420519}, {"columns": ["col3_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 819276206267928618, "histo_col_type": "", "name": "__auto__", "null_count": 1067765628333244650, "row_count": 1532105224372420519}, {"columns": ["col3_20"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1487308288087780281, "histo_col_type": "", "name": "__auto__", "null_count": 606820216678058420, "row_count": 1532105224372420519}, {"columns": ["col3_22"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1470304517583906958, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1532105224372420519}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1014700399912408341, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1532105224372420519}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 46281486111829397, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1532105224372420519}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1496942158174673653, "histo_col_type": "", "name": "__auto__", "null_count": 257403104834893528, "row_count": 1532105224372420519}, {"columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 781580950275578883, "histo_col_type": "", "name": "__auto__", "null_count": 1372342518983638269, "row_count": 1532105224372420519}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1276212967314832001, "histo_col_type": "", "name": "__auto__", "null_count": 900843695545880645, "row_count": 1532105224372420519}, {"columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1066962213396874622, "histo_col_type": "", "name": "__auto__", "null_count": 1484864028020337531, "row_count": 1532105224372420519}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1377571571341164654, "histo_col_type": "", "name": "__auto__", "null_count": 1348341023023129052, "row_count": 1532105224372420519}, {"columns": ["col3_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1394275843909875839, "histo_buckets": [{"distinct_range": 0, "num_eq": 50, "num_range": 0, "upper_bound": "1996-11-21 08:18:37.000682+00:00"}], "histo_col_type": "TIMESTAMPTZ", "name": "__auto__", "null_count": 785805704320638684, "row_count": 1532105224372420519}, {"columns": ["col3_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 249903817329383579, "histo_col_type": "", "name": "__auto__", "null_count": 858218514123765642, "row_count": 1532105224372420519}, {"columns": ["col3_23"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 384805470303909109, "histo_col_type": "", "name": "__auto__", "null_count": 390857961166038029, "row_count": 1532105224372420519}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 425854244765280924, "histo_buckets": [{"distinct_range": 0, "num_eq": 200000, "num_range": 0, "upper_bound": "-7173932839958527164"}, {"distinct_range": 90000, "num_eq": 700000000, "num_range": 90000, "upper_bound": "-4263750179025553997"}, {"distinct_range": 148181870157397150, "num_eq": 800000000, "num_range": 344868008289152481, "upper_bound": "-3421732790381700250"}, {"distinct_range": 0, "num_eq": 70000000, "num_range": 8000, "upper_bound": "-3000240509217891593"}, {"distinct_range": 0, "num_eq": 2988717754017991972, "num_range": 100000, "upper_bound": "-2758581899957432874"}, {"distinct_range": 9000, "num_eq": 80000000000, "num_range": 9000, "upper_bound": "-2594074453307455509"}, {"distinct_range": 5000000, "num_eq": 745364052963108965, "num_range": 5000000, "upper_bound": "621501429893072616"}, {"distinct_range": 20, "num_eq": 1161696692895375511, "num_range": 20, "upper_bound": "4768179317892790744"}, {"distinct_range": 0, "num_eq": 3480416672671478424, "num_range": 40, "upper_bound": "7121929147748970585"}], "histo_col_type": "INT8", "name": "__auto__", "null_count": 0, "row_count": 1532105224372420519}, {"columns": ["col3_21"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1488032903836901968, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1532105224372420519}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 189545441260664550, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1532105224372420519}, {"columns": ["col3_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 177800123230545529, "histo_col_type": "", "name": "__auto__", "null_count": 232240026800210568, "row_count": 1532105224372420519}, {"columns": ["col3_19"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 444357201319628817, "histo_col_type": "", "name": "__auto__", "null_count": 604418707944295197, "row_count": 1532105224372420519}, {"columns": ["col3_24"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 518383990695662736, "histo_col_type": "", "name": "__auto__", "null_count": 1219220515800872798, "row_count": 1532105224372420519}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('elwldt');
        CREATE TYPE rand_typ_1 AS ENUM ('hu');
        CREATE TYPE rand_typ_2 AS ENUM ('lpmlcm', 'n', 'ee', 'iox', 'qhb');
        CREATE TYPE rand_typ_3 AS ENUM ('r', 'hzfmx', 'qfvaj');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith940009916
--- FAIL: TestRandomSyntaxSQLSmith (300.74s)
Reproduce

To reproduce, try:

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

Internal log

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

/cc @rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

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

        		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 REGPROCEDURE NOT NULL, col1_1 DATE NOT NULL, col1_2 JSONB NOT NULL, col1_3 STRING NOT NULL AS (lower(CAST(col1_1 AS STRING))) STORED, UNIQUE (col1_3 ASC, col1_0) WHERE (table1.col1_1 <= '-infinity':::DATE) OR (table1.col1_3 <= e'\U00002603':::STRING), INDEX (col1_3 ASC) WHERE (table1.col1_3 != '"':::STRING) AND (table1.col1_1 >= '4714-11-24 BC':::DATE), INVERTED INDEX (col1_0, col1_3 DESC, col1_1 DESC, col1_2), FAMILY (col1_1), FAMILY (col1_2, col1_3), FAMILY (col1_0));
        CREATE TABLE table2 (col2_0 GEOGRAPHY[] NULL, col2_1 GEOGRAPHY, col2_2 DATE NULL, col2_3 STRING NULL AS (CASE WHEN col2_0 IS NULL THEN 'm':::STRING ELSE e'\x1b\x1608Q':::STRING END) VIRTUAL, col2_4 STRING AS (lower(CAST(col2_1 AS STRING))) VIRTUAL, INDEX (col2_2 ASC) STORING (col2_0) WHERE (table2.col2_3 != e'\x00':::STRING) OR (table2.col2_2 != '-infinity':::DATE), INVERTED INDEX (col2_1 ASC));
        CREATE TABLE table3 (col3_0 BOX2D NOT NULL, col3_1 TIMESTAMPTZ NOT NULL, col3_2 GEOGRAPHY, PRIMARY KEY (col3_1 ASC, col3_0 ASC), col3_3 STRING NOT NULL AS (CASE WHEN col3_1 IS NULL THEN e'\n\x0e':::STRING ELSE e'F\x0eg~)M\tY':::STRING END) STORED, INVERTED INDEX (col3_2 ASC), INVERTED INDEX (col3_0 ASC, col3_2 DESC), INVERTED INDEX (col3_1 ASC, col3_0 DESC, col3_2) WHERE (table3.col3_1 > '-4713-11-24 00:00:00+00:00':::TIMESTAMPTZ) OR (table3.col3_3 <= 'X':::STRING), UNIQUE (col3_3 ASC, col3_1 DESC, col3_0 ASC) STORING (col3_2) WHERE (table3.col3_3 < '"':::STRING) OR (table3.col3_1 = '294276-12-31 23:59:59.999999+00:00':::TIMESTAMPTZ));
        CREATE TABLE table4 (col4_0 OID, col4_1 BYTES NULL, col4_2 OID, col4_3 FLOAT8 NOT NULL, col4_4 INT2 NOT NULL, col4_5 VARCHAR NULL, col4_6 INT4 NOT NULL, col4_7 REGPROCEDURE NOT NULL, col4_8 STRING NOT NULL, col4_9 BYTES, PRIMARY KEY (col4_8, col4_7 ASC, col4_3 ASC, col4_4), col4_10 INT2 NOT NULL AS (col4_4 + col4_6) STORED, col4_11 STRING NOT NULL AS (lower(CAST(col4_7 AS STRING))) STORED, col4_12 INT4 AS (col4_6 + col4_4) VIRTUAL, col4_13 FLOAT8 NOT NULL AS (col4_3 + 0.9533363104908257:::FLOAT8) VIRTUAL, col4_14 STRING AS (lower(CAST(col4_0 AS STRING))) STORED, UNIQUE (col4_13 ASC, col4_10 ASC, col4_8 ASC, col4_2 DESC, col4_4 ASC) STORING (col4_0, col4_5, col4_6, col4_9, col4_11), INDEX (col4_5 DESC, col4_3 ASC, col4_11 DESC) STORING (col4_0, col4_10) WHERE ((((((((table4.col4_5 != 'X':::STRING) OR (table4.col4_10 >= (-1):::INT8)) OR (table4.col4_12 = (-32768):::INT8)) OR (table4.col4_11 > e'\'':::STRING)) AND (table4.col4_14 >= '"':::STRING)) AND (table4.col4_1 > '\x00':::BYTES)) OR (table4.col4_4 >= (-1):::INT8)) OR (table4.col4_3 != 1.0:::FLOAT8)) OR (table4.col4_6 = 127:::INT8), INDEX (col4_11 DESC, col4_5 ASC, col4_8, col4_6 ASC, col4_7, col4_3 ASC, col4_2 ASC, col4_1 DESC), INDEX (col4_7 ASC, col4_8 ASC, col4_1 DESC, col4_11, col4_10, col4_9) STORING (col4_5), INDEX (col4_4 DESC, col4_6 ASC) STORING (col4_10, col4_11), UNIQUE (col4_8 ASC, col4_3, col4_0 ASC, col4_4 DESC) WHERE (((((((table4.col4_10 <= 1:::INT8) AND (table4.col4_8 != '"':::STRING)) OR (table4.col4_14 <= '"':::STRING)) AND (table4.col4_4 <= 32767:::INT8)) OR (table4.col4_3 = 1.401298464324817e-45:::FLOAT8)) OR (table4.col4_5 >= 'X':::STRING)) AND (table4.col4_13 < 1.0:::FLOAT8)) AND (table4.col4_6 < 127:::INT8), INDEX (col4_13 ASC, col4_4 ASC, col4_1, col4_7, col4_11, col4_6, col4_3, col4_9 ASC, col4_2 ASC, col4_12 ASC, col4_5 ASC, col4_14 ASC), UNIQUE (col4_5, col4_10 DESC) STORING (col4_6, col4_9, col4_11, col4_14) WHERE (((((((((((table4.col4_11 != e'\x00':::STRING) AND (table4.col4_14 >= e'\'':::STRING)) AND (table4.col4_4 <= (-128):::INT8)) OR (table4.col4_3 <= 1.401298464324817e-45:::FLOAT8)) OR (table4.col4_1 > '\xff':::BYTES)) AND (table4.col4_6 < (-2147483648):::INT8)) OR (table4.col4_12 < (-1):::INT8)) OR (table4.col4_8 >= 'X':::STRING)) OR (table4.col4_13 > 1.401298464324817e-45:::FLOAT8)) OR (table4.col4_9 < '\xe29883':::BYTES)) AND (table4.col4_10 <= 127:::INT8)) OR (table4.col4_5 > e'\U00002603':::STRING));
        ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 660952420961615458, "histo_buckets": [{"distinct_range": 0, "num_eq": 200000, "num_range": 0, "upper_bound": "880370694"}, {"distinct_range": 0, "num_eq": 60000000, "num_range": 5397488197303022863, "upper_bound": "1230482144"}, {"distinct_range": 0, "num_eq": 3913401748043417972, "num_range": 100, "upper_bound": "3114087604"}], "histo_col_type": "REGPROCEDURE", "name": "__auto__", "null_count": 0, "row_count": 5737926540481212481}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2858719168016067412, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5737926540481212481}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3654439237681016822, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5737926540481212481}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 823437749346036782, "histo_buckets": [{"distinct_range": 0, "num_eq": 4988896542344123025, "num_range": 0, "upper_bound": "\\u000b3"}, {"distinct_range": 0, "num_eq": 300000, "num_range": 10723519919553426, "upper_bound": "1/2"}, {"distinct_range": 0, "num_eq": 0, "num_range": 700000, "upper_bound": "iuvP["}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 5737926540481212481}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2665690542021663133, "histo_col_type": "", "name": "__auto__", "null_count": 4618749469422125382, "row_count": 5300606815973740219}, {"columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4657109113421297543, "histo_col_type": "", "name": "__auto__", "null_count": 392927529283222540, "row_count": 5300606815973740219}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4601118326545309763, "histo_buckets": [{"distinct_range": 0, "num_eq": 1270373382516324733, "num_range": 0, "upper_bound": "\\\\x42fd100000000000000000c00921fb54442d18bff2a160f3b3efcb400921fb54442d183ff716ad8cf34497"}, {"distinct_range": 0, "num_eq": 1000, "num_range": 7000, "upper_bound": "\\\\x42fd18f872e5d9f992a500bfd8d7eb49dbd684bff0976292acc12ec00910fb28ae45593ff177c8c8171141"}, {"distinct_range": 56865.715987483694, "num_eq": 1000000000, "num_range": 60000, "upper_bound": "\\\\x42fd300000000000000000c00921fb54442d18bff2a160f3b3efcb400921fb54442d183ff716ad8cf34497"}, {"distinct_range": 204447.45566955768, "num_eq": 70000000, "num_range": 400000, "upper_bound": "\\\\x42fd34f41c11e62c41430140018bf01ea369853fdc25a1070a6660"}, {"distinct_range": 492.95630558903446, "num_eq": 30000000000, "num_range": 30000, "upper_bound": "\\\\x42fd500000000000000000c00921fb54442d18bff2a160f3b3efcb400921fb54442d183ff716ad8cf34497"}, {"distinct_range": 0, "num_eq": 8000000000, "num_range": 2114461726229852978, "upper_bound": "\\\\x42fd59e14f429bf8084b00bfd8d7eb49dbd684bff0976292acc12ec00910fb28ae45593ff177c8c8171141"}, {"distinct_range": 6052721977957877000, "num_eq": 100, "num_range": 6052721977957876264, "upper_bound": "\\\\x42fd700000000000000000c00921fb54442d18bff2a160f3b3efcb400921fb54442d183ff716ad8cf34497"}, {"distinct_range": 0, "num_eq": 0, "num_range": 600000000, "upper_bound": "\\\\x42fd900000000000000000c00921fb54442d18bff2a160f3b3efcb400921fb54442d183ff716ad8cf34497"}, {"distinct_range": 5925600013854444000, "num_eq": 600, "num_range": 8739245841005195973, "upper_bound": "\\\\x42fda6276b3d53ed066700bfd8d7eb49dbd684bff0976292acc12ec00910fb28ae45593ff177c8c8171141"}, {"distinct_range": 37.61403840539066, "num_eq": 300000, "num_range": 90, "upper_bound": "\\\\x42fdb00000000000000000c00921fb54442d18bff2a160f3b3efcb400921fb54442d183ff716ad8cf34497"}, {"distinct_range": 4575669665371808300, "num_eq": 400000000, "num_range": 8334920490857741435, "upper_bound": "\\\\x42fdb91a51fd9db39ee100bfd8d7eb49dbd684bff0976292acc12ec00910fb28ae45593ff177c8c8171141"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 1329958836333738736, "row_count": 5300606815973740219}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3129964953612520910, "histo_buckets": [{"distinct_range": 0, "num_eq": 5659816464989466643, "num_range": 0, "upper_bound": "1971-12-28"}, {"distinct_range": 743364633195611000, "num_eq": 10000000000, "num_range": 1771794155077097973, "upper_bound": "1974-03-23"}, {"distinct_range": 12.044515615242302, "num_eq": 6365408232905383298, "num_range": 20, "upper_bound": "1975-08-23"}, {"distinct_range": 1014753786732303700, "num_eq": 400, "num_range": 1014753786732303760, "upper_bound": "1975-09-05"}, {"distinct_range": 3889139816050857000, "num_eq": 6455742140972309148, "num_range": 9046598757195706855, "upper_bound": "1976-06-11"}, {"distinct_range": 8436539855196620000, "num_eq": 3704485003841533284, "num_range": 8436539855196620071, "upper_bound": "1979-07-06"}, {"distinct_range": 631296904670465000, "num_eq": 8686427539701394512, "num_range": 631296904670465017, "upper_bound": "1983-11-07"}, {"distinct_range": 2000000000, "num_eq": 5000000, "num_range": 2000000000, "upper_bound": "1991-10-11"}], "histo_col_type": "DATE", "name": "__auto__", "null_count": 673369801882485673, "row_count": 5300606815973740219}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5145882543391512179, "histo_col_type": "", "name": "__auto__", "null_count": 3307076434494530888, "row_count": 5300606815973740219}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS e'[{"columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 582324999928471240, "histo_buckets": [{"distinct_range": 0, "num_eq": 8754606976729277305, "num_range": 0, "upper_bound": "BOX(-2.5884934815535465 -1.624165279635449,-1.0171491011231528 -0.8776573329184604)"}], "histo_col_type": "BOX2D", "name": "__auto__", "null_count": 0, "row_count": 4575415206515000579}, {"columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3262222308207479715, "histo_buckets": [{"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "1972-03-28 06:05:27.000106+00:00"}, {"distinct_range": 8604231263.362759, "num_eq": 8808778968334028050, "num_range": 9000000000, "upper_bound": "1977-11-18 05:43:23.000879+00:00"}, {"distinct_range": 0, "num_eq": 6000, "num_range": 100, "upper_bound": "1985-03-13 04:26:51.000671+00:00"}, {"distinct_range": 6289408800495395000, "num_eq": 8115152503059150816, "num_range": 7140306082252555740, "upper_bound": "2000-01-22 19:43:26.000337+00:00"}, {"distinct_range": 1591053199.2018998, "num_eq": 0, "num_range": 3000000000, "upper_bound": "2009-09-27 10:50:20.000286+00:00"}, {"distinct_range": 351754.9900061092, "num_eq": 5357373614326767877, "num_range": 400000, "upper_bound": "2021-10-23 16:28:39.000278+00:00"}, {"distinct_range": 0, "num_eq": 800000000, "num_range": 300000, "upper_bound": "2027-07-16 06:51:52.000432+00:00"}], "histo_col_type": "TIMESTAMPTZ", "name": "__auto__", "null_count": 0, "row_count": 4575415206515000579}, {"columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2880149880045621497, "histo_buckets": [{"distinct_range": 0, "num_eq": 4000, "num_range": 0, "upper_bound": "\\\\x42fd0400000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}, {"distinct_range": 0, "num_eq": 10000000000, "num_range": 0, "upper_bound": "\\\\x42fd0c00000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}, {"distinct_range": 0, "num_eq": 6572118583828545731, "num_range": 200000, "upper_bound": "\\\\x42fd1000000000000000004007cb02773227b4bfe3b197e657cc5e3ffc196ce69f75213ff61159741fd144"}, {"distinct_range": 0, "num_eq": 100000000000, "num_range": 10000000000, "upper_bound": "\\\\x42fd1c5902fef3bfec9300bff2527526f31397bff5d7e0c776a947c00653c588f42f393ff55041353935a7"}, {"distinct_range": 70000, "num_eq": 3372433091917749060, "num_range": 70000, "upper_bound": "\\\\x42fd2b00000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}, {"distinct_range": 79.45372001069677, "num_eq": 3000000000, "num_range": 200, "upper_bound": "\\\\x42fd3000000000000000004007cb02773227b4bfe3b197e657cc5e3ffc196ce69f75213ff61159741fd144"}, {"distinct_range": 0, "num_eq": 70000000000, "num_range": 0, "upper_bound": "\\\\x42fd46d4f7942152f44d00bff2527526f31397bff5d7e0c776a947c00653c588f42f393ff55041353935a7"}, {"distinct_range": 0, "num_eq": 8107732578587591990, "num_range": 727194178215818786, "upper_bound": "\\\\x42fd5000000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}, {"distinct_range": 0, "num_eq": 0, "num_range": 900, "upper_bound": "\\\\x42fd5000000000000000004007cb02773227b4bfe3b197e657cc5e3ffc196ce69f75213ff61159741fd144"}, {"distinct_range": 13058521550.471622, "num_eq": 40, "num_range": 20000000000, "upper_bound": "\\\\x42fd5b2528a06c95ae7f00bff2527526f31397bff5d7e0c776a947c00653c588f42f393ff55041353935a7"}, {"distinct_range": 0, "num_eq": 6979992137245693104, "num_range": 6877179901344684334, "upper_bound": "\\\\x42fd7000000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}, {"distinct_range": 6000000000, "num_eq": 0, "num_range": 6000000000, "upper_bound": "\\\\x42fd735077cd35d7a3d300bff2527526f31397bff5d7e0c776a947c00653c588f42f393ff55041353935a7"}, {"distinct_range": 6271427.632085998, "num_eq": 669170122590855344, "num_range": 10000000, "upper_bound": "\\\\x42fd8c1bec294943996f00bff2527526f31397bff5d7e0c776a947c00653c588f42f393ff55041353935a7"}, {"distinct_range": 1311384634.1499956, "num_eq": 70000000000, "num_range": 9000000000, "upper_bound": "\\\\x42fd9000000000000000004007cb02773227b4bfe3b197e657cc5e3ffc196ce69f75213ff61159741fd144"}, {"distinct_range": 0, "num_eq": 90, "num_range": 8587008678299299989, "upper_bound": "\\\\x42fda05f3266ca6017e101c0036233d6202376bfe8229512dbb386"}, {"distinct_range": 0, "num_eq": 90, "num_range": 8076897526395325742, "upper_bound": "\\\\x42fda0c0000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}, {"distinct_range": 869336260852347900, "num_eq": 80000000, "num_range": 869336260852347908, "upper_bound": "\\\\x42fda121000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}, {"distinct_range": 0, "num_eq": 3023978783333840707, "num_range": 90, "upper_bound": "\\\\x42fda554000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}, {"distinct_range": 4659345697983394000, "num_eq": 3685090062022325388, "num_range": 4659345697983393880, "upper_bound": "\\\\x42fdac00000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}, {"distinct_range": 0, "num_eq": 8228631864754334165, "num_range": 4000000000, "upper_bound": "\\\\x42fdaf79bc9e20e7368d00bff2527526f31397bff5d7e0c776a947c00653c588f42f393ff55041353935a7"}, {"distinct_range": 153967738.0760227, "num_eq": 4494199313557622129, "num_range": 700000000, "upper_bound": "\\\\x42fdb400000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}, {"distinct_range": 7860.446869851914, "num_eq": 5577193535527093969, "num_range": 60000, "upper_bound": "\\\\x42fdb9c0000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}, {"distinct_range": 0, "num_eq": 600000000, "num_range": 0, "upper_bound": "\\\\x42fdbb00000000000000003fff0b27347d70cabff8c9e52442b6ca3fe3bbc9705224803ff8531eee9f586d"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 1998201286226620989, "row_count": 4575415206515000579}, {"columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 376861417691481155, "histo_buckets": [{"distinct_range": 0, "num_eq": 5933650776270928316, "num_range": 0, "upper_bound": "@Et\\u001c\\u0004e"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 4575415206515000579}]':::JSONB;
        ALTER TABLE table4 INJECT STATISTICS e'[{"columns": ["col4_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 20175710786, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"columns": ["col4_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 45058760948, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"columns": ["col4_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 46955031204, "histo_col_type": "", "name": "__auto__", "null_count": 19952330011, "row_count": 70000000000}, {"columns": ["col4_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5238351404, "histo_buckets": [{"distinct_range": 0, "num_eq": 20, "num_range": 0, "upper_bound": "-Inf"}, {"distinct_range": 0, "num_eq": 200000, "num_range": 8939817996102184739, "upper_bound": "-1.8167240092579149"}, {"distinct_range": 0, "num_eq": 4449161034858744677, "num_range": 7000000, "upper_bound": "0.4348828664680918"}, {"distinct_range": 0, "num_eq": 5396326474402165923, "num_range": 0, "upper_bound": "0.503088223564214"}, {"distinct_range": 0, "num_eq": 401439258111050303, "num_range": 4089298755672097862, "upper_bound": "1.0"}], "histo_col_type": "FLOAT8", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"columns": ["col4_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 30169959322, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"columns": ["col4_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 62509635596, "histo_buckets": [{"distinct_range": 0, "num_eq": 5803633802394417419, "num_range": 0, "upper_bound": "-25771"}, {"distinct_range": 2929752195795764000, "num_eq": 1000, "num_range": 2929752195795764098, "upper_bound": "-22076"}, {"distinct_range": 0, "num_eq": 6542107548383207478, "num_range": 9000000, "upper_bound": "-11770"}, {"distinct_range": 3446121615692685300, "num_eq": 0, "num_range": 3446121615692685444, "upper_bound": "5864"}, {"distinct_range": 89090.06428853674, "num_eq": 772360663403390878, "num_range": 200000, "upper_bound": "5905"}, {"distinct_range": 700000, "num_eq": 10000000, "num_range": 700000, "upper_bound": "27831"}], "histo_col_type": "INT2", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"columns": ["col4_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 56165801465, "histo_col_type": "", "name": "__auto__", "null_count": 63514199464, "row_count": 70000000000}, {"columns": ["col4_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4569922115, "histo_col_type": "", "name": "__auto__", "null_count": 10427398038, "row_count": 70000000000}, {"columns": ["col4_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 60611453732, "histo_buckets": [{"distinct_range": 0, "num_eq": 7806982599466679893, "num_range": 0, "upper_bound": "\\""}, {"distinct_range": 0, "num_eq": 7587997018348480834, "num_range": 5262751457491144406, "upper_bound": "\'"}, {"distinct_range": 0, "num_eq": 1133426352481897402, "num_range": 0, "upper_bound": "1I\\u000fcE\\t?%\\u000f"}, {"distinct_range": 380336.36326176673, "num_eq": 4000, "num_range": 400000, "upper_bound": "GaR\x7f\\u000bdq"}], "histo_col_type": "VARCHAR", "name": "__auto__", "null_count": 7769582279, "row_count": 70000000000}, {"columns": ["col4_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 55030798148, "histo_buckets": [{"distinct_range": 0, "num_eq": 7504482248556157488, "num_range": 0, "upper_bound": ""}, {"distinct_range": 7935101882695536000, "num_eq": 0, "num_range": 7935101882695536004, "upper_bound": "\\u0014"}, {"distinct_range": 200000000, "num_eq": 1000000000, "num_range": 200000000, "upper_bound": "\\u0014w%\\u001b\\u0018P?=f"}, {"distinct_range": 1594130026.330542, "num_eq": 60000, "num_range": 9000000000, "upper_bound": "P\\u0012{s"}, {"distinct_range": 193.30008838319785, "num_eq": 8298404028385965694, "num_range": 60000, "upper_bound": "Y2*"}, {"distinct_range": 0, "num_eq": 900000, "num_range": 300000, "upper_bound": "^\\u001d]"}, {"distinct_range": 597288597230635000, "num_eq": 516257099876696953, "num_range": 5662689357321690869, "upper_bound": "lv3"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"columns": ["col4_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 14936224250, "histo_col_type": "", "name": "__auto__", "null_count": 9323071806, "row_count": 70000000000}, {"columns": ["col4_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 40992893306, "histo_buckets": [{"distinct_range": 0, "num_eq": 90000, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 4361574247226254300, "num_eq": 2893960106279873079, "num_range": 4361574247226254395, "upper_bound": "406242014"}, {"distinct_range": 7954972922538095000, "num_eq": 4000000, "num_range": 7954972922538095030, "upper_bound": "1426333563"}], "histo_col_type": "REGPROCEDURE", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"columns": ["col4_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 38569543821, "histo_buckets": [{"distinct_range": 0, "num_eq": 988488321744850971, "num_range": 0, "upper_bound": "CR{@"}, {"distinct_range": 0, "num_eq": 900000000, "num_range": 5409403750798147200, "upper_bound": "Lq\\u0005\\u0011e"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"columns": ["col4_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 37681273408, "histo_col_type": "", "name": "__auto__", "null_count": 49624467407, "row_count": 70000000000}, {"columns": ["col4_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 46911531295, "histo_col_type": "", "name": "__auto__", "null_count": 35312017127, "row_count": 70000000000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('lucl');
        CREATE TYPE rand_typ_1 AS ENUM ('b');
        CREATE TYPE rand_typ_2 AS ENUM ('pjkrf', 'zhegri', 'sniedo');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith874190624
--- FAIL: TestRandomSyntaxSQLSmith (300.60s)
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 @rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

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

        CREATE TABLE table2 (col1_0 BOX2D NOT NULL, col1_1 TIME NOT NULL, col2_2 REGPROC, col2_3 VARCHAR NOT NULL, col2_4 BIT(49) NOT NULL, col2_5 BOOL NOT NULL, col2_6 CHAR NOT NULL, col2_7 REGCLASS NOT NULL, col2_8 BOX2D, col2_9 BOX2D NULL, col2_10 TIMESTAMPTZ NULL, PRIMARY KEY (col1_0, col1_1 ASC), UNIQUE (col2_8, col1_0) STORING (col2_2, col2_3, col2_4, col2_6, col2_9, col2_10) WHERE ((((table2.col2_3 > e'\'':::STRING) OR (table2.col2_6 = e'\U00002603':::STRING)) OR (table2.col2_10 < '3000-01-01 00:00:00+00:00':::TIMESTAMPTZ)) AND (table2.col1_1 = '24:00:00':::TIME)) AND (NOT table2.col2_5), INDEX (col2_3 ASC, col2_7) WHERE ((((table2.col2_3 != e'\x00':::STRING) AND (table2.col2_6 < e'\x00':::STRING)) OR table2.col2_5) OR (table2.col2_10 < '-2000-01-01 00:00:00+00:00':::TIMESTAMPTZ)) AND (table2.col1_1 < '24:00:00':::TIME), INDEX (col2_7 DESC, col2_6, col2_4 ASC, col1_1 ASC, col2_8) STORING (col2_5, col2_9, col2_10), INDEX (col2_4 DESC, col2_2, col2_9 DESC, col2_7 ASC, col2_8 ASC, col1_1 ASC, col2_5 DESC, col2_6, col1_0 ASC, col2_3 ASC) STORING (col2_10), UNIQUE (col2_5, col1_1 ASC, col2_10, col2_3 DESC, col2_9 ASC, col2_6, col2_7 ASC, col2_2 DESC) STORING (col2_4), INDEX (col2_2 ASC, col2_9 ASC, col2_10) STORING (col2_3, col2_6, col2_7, col2_8), UNIQUE (col2_9 ASC, col2_4 ASC, col2_3 DESC, col2_8, col1_1 DESC) WHERE table2.col2_3 <= e'\'':::STRING, INDEX (col2_8 DESC, col2_9 DESC, col1_0, col2_6 ASC, col2_4, col2_2 DESC, col1_1 DESC, col2_3 ASC, col2_7, col2_5 ASC, col2_10 DESC) WHERE ((table2.col2_10 >= '294276-12-31 23:59:59.999999+00:00':::TIMESTAMPTZ) AND (table2.col2_3 < e'\U00002603':::STRING)) OR (NOT table2.col2_5), UNIQUE (col2_5 DESC, col2_10 ASC, col2_4 ASC, col1_0 ASC), FAMILY (col1_0), FAMILY (col2_5), FAMILY (col2_2, col2_7, col1_1), FAMILY (col2_8), FAMILY (col2_9, col2_10), FAMILY (col2_6), FAMILY (col2_4), FAMILY (col2_3)) INTERLEAVE IN PARENT table1 (col1_0, col1_1);
        CREATE TABLE table3 (col3_0 INT2 NOT NULL, col3_1 NAME NOT NULL, col3_2 REGNAMESPACE NOT NULL, col3_3 TIMESTAMP NOT NULL, PRIMARY KEY (col3_1 DESC, col3_3 DESC), col3_4 STRING NOT NULL AS (lower(CAST(col3_3 AS STRING))) VIRTUAL, UNIQUE (col3_0 ASC, col3_1 DESC, col3_4 DESC, col3_2 DESC, col3_3 DESC) WHERE ((table3.col3_3 = '-2000-01-01 00:00:00':::TIMESTAMP) AND (table3.col3_1 <= e'\x00':::STRING)) AND (table3.col3_0 = (-1):::INT8), INDEX (col3_1 ASC, col3_3, col3_0 DESC, col3_2 DESC) WHERE (table3.col3_0 <= (-32768):::INT8) OR (table3.col3_3 > '-4713-11-24 00:00:00':::TIMESTAMP), UNIQUE (col3_1, col3_4, col3_0 ASC, col3_2 ASC), UNIQUE (col3_3 ASC), UNIQUE (col3_3 ASC, col3_1 ASC, col3_0 ASC, col3_2 ASC, col3_4), UNIQUE (col3_2, col3_1));
        CREATE TABLE table4 (col4_0 REGTYPE NULL, col4_1 REGPROC NULL, col4_2 REGPROC NOT NULL, col4_3 REGPROC NULL, col4_4 REGPROC, col4_5 INT2 NOT NULL, col4_6 OID NOT NULL, col4_7 INT4 NULL, col4_8 TIMESTAMP NULL, col4_9 TIME NULL, col4_10 REGPROC NULL, PRIMARY KEY (col4_6 ASC), col4_11 INT2 NOT NULL AS (col4_5 + 19388:::INT8) VIRTUAL, col4_12 STRING NOT NULL AS (lower(CAST(col4_6 AS STRING))) VIRTUAL, col4_13 STRING NULL AS (lower(CAST(col4_1 AS STRING))) STORED, col4_14 INT4 NULL AS (col4_7 + col4_5) VIRTUAL, col4_15 INT2 NULL AS (col4_5 + col4_7) VIRTUAL, INDEX (col4_9 DESC, col4_7, col4_1, col4_5 DESC, col4_3 DESC, col4_15 DESC, col4_10 DESC, col4_8 DESC, col4_6 DESC, col4_4 ASC, col4_2 DESC, col4_12 ASC, col4_0 ASC, col4_11 ASC, col4_13 DESC), FAMILY (col4_1, col4_8, col4_5, col4_13, col4_7), FAMILY (col4_6, col4_2), FAMILY (col4_4), FAMILY (col4_10), FAMILY (col4_3, col4_0), FAMILY (col4_9));
        CREATE TABLE table5 (col1_0 BOX2D NOT NULL, col1_1 TIME NOT NULL, col5_2 FLOAT4, col5_3 INT8 NOT NULL, col5_4 TIMESTAMPTZ, col5_5 REGTYPE NOT NULL, col5_6 FLOAT8 NOT NULL, col5_7 INT8, col5_8 NAME NULL, col5_9 TIME NULL, col5_10 TIMESTAMP NOT NULL, col5_11 REGPROC, col5_12 STRING NOT NULL, col5_13 BIT(30) NOT NULL, col5_14 INET, col5_15 "char" NULL, col5_16 TIME NULL, col5_17 BOX2D NULL, col5_18 REGPROCEDURE, col5_19 FLOAT4 NULL, col5_20 TIMESTAMPTZ NULL, PRIMARY KEY (col1_0, col1_1 ASC, col5_5 ASC, col5_13, col5_7 DESC, col5_18, col5_4 DESC, col5_17 DESC, col5_6, col5_8 DESC, col5_3 DESC, col5_15, col5_16 DESC, col5_20 DESC, col5_2 ASC, col5_19, col5_14 ASC, col5_10 DESC, col5_12 ASC), UNIQUE (col1_0 ASC, col5_16, col5_2 DESC, col5_13 DESC, col5_19 ASC, col5_4 DESC, col5_9, col5_11) WHERE table5.col5_10 != '-4713-11-24 00:00:00':::TIMESTAMP, FAMILY (col5_18, col5_13, col5_10), FAMILY (col5_4, col5_15), FAMILY (col5_8, col5_7, col5_16, col5_14), FAMILY (col5_20), FAMILY (col5_9), FAMILY (col5_19), FAMILY (col1_0), FAMILY (col5_2), FAMILY (col5_17), FAMILY (col5_12), FAMILY (col5_3), FAMILY (col5_5, col1_1), FAMILY (col5_6), FAMILY (col5_11), UNIQUE (col5_8), UNIQUE (col5_5, col5_11)) INTERLEAVE IN PARENT table2 (col1_0, col1_1);
        ALTER TABLE table1 INJECT STATISTICS '[{"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 47998878069, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 39768882887, "histo_col_type": "BOX2D", "name": "__auto__", "null_count": 0, "row_count": 70000000000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 386221207388251040, "histo_buckets": [{"distinct_range": 0, "num_eq": 8000000, "num_range": 0, "upper_bound": "4100016"}, {"distinct_range": 993504522798655100, "num_eq": 20, "num_range": 3245329714234378259, "upper_bound": "595052964"}, {"distinct_range": 0, "num_eq": 5071950423087997092, "num_range": 4000, "upper_bound": "798353650"}, {"distinct_range": 0, "num_eq": 6000, "num_range": 700125539941525678, "upper_bound": "1157315874"}, {"distinct_range": 0, "num_eq": 10000000, "num_range": 1000000, "upper_bound": "2412695369"}], "histo_col_type": "REGPROC", "name": "__auto__", "null_count": 693907921802479629, "row_count": 841074314767146785}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 343317437893398945, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 841074314767146785}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 147026171537074059, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 841074314767146785}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 398694556468164100, "histo_col_type": "", "name": "__auto__", "null_count": 307707694914656887, "row_count": 841074314767146785}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 240925550393438916, "histo_buckets": [{"distinct_range": 0, "num_eq": 4377682385354249253, "num_range": 0, "upper_bound": "BOX(-1.8850212180024195 -0.8717279421186591,-1.6372734493684336 -0.17600879482833187)"}, {"distinct_range": 0, "num_eq": 10000, "num_range": 0, "upper_bound": "BOX(-1.032173327600466 -0.5074779231745047,-0.4040432901997146 0.02666992941783075)"}, {"distinct_range": 195755331871054940, "num_eq": 4977857884840261493, "num_range": 8098022252901828315, "upper_bound": "BOX(-0.7904506361321072 -0.7853749051502781,0.05323898153791917 0.6991389757734996)"}, {"distinct_range": 0, "num_eq": 200, "num_range": 3995586398828661699, "upper_bound": "BOX(-0.3897236325896361 -0.08672925453694735,1.20352142108813 -0.04957903685032572)"}, {"distinct_range": 2091619756774739700, "num_eq": 40000, "num_range": 2160405100841756254, "upper_bound": "BOX(1.1064328174003792 1.3474351208434783,1.879873678325708 1.5683648578521456)"}], "histo_col_type": "BOX2D", "name": "__auto__", "null_count": 428794094864104213, "row_count": 841074314767146785}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 683417731018496887, "histo_col_type": "", "name": "__auto__", "null_count": 636983676982835435, "row_count": 841074314767146785}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 772599090977576792, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 841074314767146785}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 188583141628155082, "histo_buckets": [{"distinct_range": 0, "num_eq": 40, "num_range": 0, "upper_bound": ""}, {"distinct_range": 0, "num_eq": 7714057278329815669, "num_range": 397979943532272701, "upper_bound": "\\n\\\\"}, {"distinct_range": 7000000000, "num_eq": 4877901908516355790, "num_range": 7000000000, "upper_bound": "\\""}, {"distinct_range": 2769093746081151000, "num_eq": 4705782180719576084, "num_range": 2769093746081150807, "upper_bound": "&%-\\u00179"}, {"distinct_range": 0, "num_eq": 8690568619998697023, "num_range": 10000, "upper_bound": "W\\"W\x7f\\u0016\\u0011"}, {"distinct_range": 0, "num_eq": 8159886612591662868, "num_range": 4267626307320581153, "upper_bound": "X"}, {"distinct_range": 0, "num_eq": 1675971623923062152, "num_range": 40000000, "upper_bound": "b\\u0019\\u0018\\\\"}], "histo_col_type": "VARCHAR", "name": "__auto__", "null_count": 0, "row_count": 841074314767146785}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 231740966149530259, "histo_buckets": [{"distinct_range": 0, "num_eq": 700, "num_range": 0, "upper_bound": "false"}, {"distinct_range": 100000, "num_eq": 9198955707152140583, "num_range": 100000, "upper_bound": "true"}], "histo_col_type": "BOOL", "name": "__auto__", "null_count": 0, "row_count": 841074314767146785}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 29553894196570299, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 841074314767146785}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 725577852216066155, "histo_buckets": [{"distinct_range": 0, "num_eq": 9000000, "num_range": 0, "upper_bound": "BOX(-10 -10,10 10)"}], "histo_col_type": "BOX2D", "name": "__auto__", "null_count": 0, "row_count": 841074314767146785}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS e'[{"columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 638376927490020964, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2520342870846435825}, {"columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 237909780595417712, "histo_buckets": [{"distinct_range": 0, "num_eq": 6809497874854615954, "num_range": 0, "upper_bound": ""}, {"distinct_range": 22471.561302841175, "num_eq": 8031144836621506718, "num_range": 40000, "upper_bound": "\\nZ5uN"}, {"distinct_range": 0, "num_eq": 2182243560328864541, "num_range": 8000000, "upper_bound": "8J"}, {"distinct_range": 8676852155363659000, "num_eq": 1533949733207225623, "num_range": 8676852155363659041, "upper_bound": "D-u]"}, {"distinct_range": 0, "num_eq": 4384747469556750706, "num_range": 200000, "upper_bound": "G]]A"}, {"distinct_range": 8079560108030279000, "num_eq": 8000000, "num_range": 8079560108030278479, "upper_bound": "\\\\\\u001emu7F3iT"}, {"distinct_range": 1225282670881259300, "num_eq": 20000000000, "num_range": 1228250305063521654, "upper_bound": "o\\u0008e"}], "histo_col_type": "NAME", "name": "__auto__", "null_count": 0, "row_count": 2520342870846435825}, {"columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1477727843536369117, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2520342870846435825}, {"columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2236747962119484200, "histo_buckets": [{"distinct_range": 0, "num_eq": 5506342217696573186, "num_range": 0, "upper_bound": "1981-02-09 06:33:51.000746"}, {"distinct_range": 4499484.481409958, "num_eq": 3845293750602381350, "num_range": 8000000, "upper_bound": "1988-09-10 15:35:13.000878"}, {"distinct_range": 335624.7138111718, "num_eq": 70, "num_range": 500000, "upper_bound": "1999-01-28 00:51:36.000072"}, {"distinct_range": 400000000, "num_eq": 30, "num_range": 400000000, "upper_bound": "2007-04-14 17:09:44.00094"}, {"distinct_range": 1618535890253127700, "num_eq": 7909098150214608644, "num_range": 2344522421954428876, "upper_bound": "2013-08-17 14:08:02.0006"}, {"distinct_range": 30000000000, "num_eq": 4364837045015288246, "num_range": 30000000000, "upper_bound": "2017-05-03 15:17:33.000732"}, {"distinct_range": 191948174310789570, "num_eq": 30000000, "num_range": 268337144241380134, "upper_bound": "2026-03-25 22:55:34.000232"}], "histo_col_type": "TIMESTAMP", "name": "__auto__", "null_count": 0, "row_count": 2520342870846435825}, {"columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2453435140378523122, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2520342870846435825}]':::JSONB;
        ALTER TABLE table4 INJECT STATISTICS '[{"columns": ["col4_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 702548190783414034, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1012622953326802860}, {"columns": ["col4_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 959491273613611104, "histo_col_type": "", "name": "__auto__", "null_count": 817079016600892777, "row_count": 1012622953326802860}, {"columns": ["col4_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 655916493331337716, "histo_col_type": "", "name": "__auto__", "null_count": 720874053015011096, "row_count": 1012622953326802860}, {"columns": ["col4_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 31547343352298310, "histo_col_type": "", "name": "__auto__", "null_count": 402105996837024981, "row_count": 1012622953326802860}, {"columns": ["col4_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 172380139749920638, "histo_col_type": "", "name": "__auto__", "null_count": 447498817955268793, "row_count": 1012622953326802860}, {"columns": ["col4_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 535706837410472513, "histo_buckets": [{"distinct_range": 0, "num_eq": 8000, "num_range": 0, "upper_bound": "02:26:42.379656"}, {"distinct_range": 1000000, "num_eq": 1000000000, "num_range": 1000000, "upper_bound": "02:42:41.925217"}, {"distinct_range": 0, "num_eq": 90000000, "num_range": 0, "upper_bound": "03:47:45.412254"}, {"distinct_range": 0, "num_eq": 7491650591974929279, "num_range": 40000, "upper_bound": "05:25:46.456433"}, {"distinct_range": 3370358490589480000, "num_eq": 1000000, "num_range": 5702214807418547606, "upper_bound": "12:53:12.450514"}, {"distinct_range": 10000000, "num_eq": 70000000000, "num_range": 10000000, "upper_bound": "19:20:18.940309"}], "histo_col_type": "TIME", "name": "__auto__", "null_count": 761781164993563241, "row_count": 1012622953326802860}, {"columns": ["col4_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 154731969595948244, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1012622953326802860}, {"columns": ["col4_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 54466916119002592, "histo_col_type": "", "name": "__auto__", "null_count": 7760319433411944, "row_count": 1012622953326802860}, {"columns": ["col4_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 484713693584938290, "histo_col_type": "", "name": "__auto__", "null_count": 517588409673154627, "row_count": 1012622953326802860}, {"columns": ["col4_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 861316556661034303, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1012622953326802860}, {"columns": ["col4_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 253385018035716430, "histo_col_type": "", "name": "__auto__", "null_count": 360960686124288752, "row_count": 1012622953326802860}, {"columns": ["col4_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 77880443934118930, "histo_col_type": "", "name": "__auto__", "null_count": 497994876593229281, "row_count": 1012622953326802860}, {"columns": ["col4_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 671185877892046079, "histo_col_type": "", "name": "__auto__", "null_count": 227713011585911211, "row_count": 1012622953326802860}, {"columns": ["col4_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 70042459124349591, "histo_buckets": [{"distinct_range": 0, "num_eq": 900, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 6390529101613477000, "num_eq": 500, "num_range": 6390529101613476790, "upper_bound": "451166818"}, {"distinct_range": 0, "num_eq": 5249723943509364312, "num_range": 0, "upper_bound": "580882502"}, {"distinct_range": 73813090.86984311, "num_eq": 8886777057007592697, "num_range": 80000000, "upper_bound": "1084617298"}, {"distinct_range": 0, "num_eq": 313088032369042226, "num_range": 1239538193769771483, "upper_bound": "1226563409"}, {"distinct_range": 1493897412502891300, "num_eq": 30000, "num_range": 5690029746491959259, "upper_bound": "2182356971"}, {"distinct_range": 6000000000, "num_eq": 8278595499262522200, "num_range": 6000000000, "upper_bound": "2619868012"}, {"distinct_range": 0, "num_eq": 100000000, "num_range": 1000, "upper_bound": "3819948324"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 0, "row_count": 1012622953326802860}, {"columns": ["col4_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 539547273934120928, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1012622953326802860}, {"columns": ["col4_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 874787338186449357, "histo_col_type": "", "name": "__auto__", "null_count": 922649092734140743, "row_count": 1012622953326802860}]':::JSONB;
        ALTER TABLE table5 INJECT STATISTICS '[{"columns": ["col5_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 9759360133, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000000000}, {"columns": ["col5_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6762201839, "histo_col_type": "", "name": "__auto__", "null_count": 2944236513, "row_count": 10000000000}, {"columns": ["col5_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5627755269, "histo_col_type": "", "name": "__auto__", "null_count": 1133717475, "row_count": 10000000000}, {"columns": ["col5_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6022465541, "histo_col_type": "", "name": "__auto__", "null_count": 5001990269, "row_count": 10000000000}, {"columns": ["col5_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2820878712, "histo_col_type": "", "name": "__auto__", "null_count": 3266540283, "row_count": 10000000000}, {"columns": ["col5_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5620747087, "histo_col_type": "", "name": "__auto__", "null_count": 2709491437, "row_count": 10000000000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7608914893, "histo_buckets": [{"distinct_range": 0, "num_eq": 7092237462875356158, "num_range": 0, "upper_bound": "BOX(-1.7551524955283049 -0.2606198305743848,-1.0790612180913866 0.6555336787012676)"}, {"distinct_range": 0, "num_eq": 9000, "num_range": 3583462529524118206, "upper_bound": "BOX(0.12974770542458475 -0.2595048912195182,0.3238335971195271 0.7232230385282458)"}], "histo_col_type": "BOX2D", "name": "__auto__", "null_count": 0, "row_count": 10000000000}, {"columns": ["col5_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2484399215, "histo_col_type": "", "name": "__auto__", "null_count": 1485885202, "row_count": 10000000000}, {"columns": ["col5_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8104559890, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000000000}, {"columns": ["col5_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4830745479, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000000000}, {"columns": ["col5_19"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 9310245984, "histo_col_type": "", "name": "__auto__", "null_count": 7312187016, "row_count": 10000000000}, {"columns": ["col5_18"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4267423318, "histo_col_type": "", "name": "__auto__", "null_count": 620358809, "row_count": 10000000000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4044669720, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000000000}, {"columns": ["col5_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8064972180, "histo_col_type": "", "name": "__auto__", "null_count": 5170165977, "row_count": 10000000000}, {"columns": ["col5_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3228691154, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000000000}, {"columns": ["col5_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5475732451, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000000000}, {"columns": ["col5_20"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1436011915, "histo_col_type": "", "name": "__auto__", "null_count": 9942027504, "row_count": 10000000000}, {"columns": ["col5_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 674364590, "histo_col_type": "", "name": "__auto__", "null_count": 7273990522, "row_count": 10000000000}, {"columns": ["col5_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1635928425, "histo_col_type": "", "name": "__auto__", "null_count": 3773489338, "row_count": 10000000000}, {"columns": ["col5_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 464202056, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 10000000000}, {"columns": ["col5_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 703463087, "histo_col_type": "", "name": "__auto__", "null_count": 6510754302, "row_count": 10000000000}]':::JSONB;
        ALTER TABLE table2 ADD FOREIGN KEY (col2_7, col2_6) REFERENCES table3 (col3_2, col3_1);
        ALTER TABLE table3 ADD FOREIGN KEY (col3_1) REFERENCES table5 (col5_8) ON UPDATE CASCADE;
        ALTER TABLE table4 ADD FOREIGN KEY (col4_3, col4_6) REFERENCES table5 (col5_5, col5_11);
        CREATE TYPE rand_typ_0 AS ENUM ('a');
        CREATE TYPE rand_typ_1 AS ENUM ('nmmo', 'lidau', 'ftkwa', 'ghcmn', 'w');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith092066440
--- FAIL: TestRandomSyntaxSQLSmith (301.02s)
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 @rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

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

        
        		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 NAME, col1_1 REGPROC NOT NULL, col1_2 REGCLASS NULL, col1_3 GEOMETRY NOT NULL, col1_4 DATE NOT NULL, col1_5 "char" NOT NULL, col1_6 REGCLASS NOT NULL, col1_7 "char" NOT NULL, col1_8 BYTES NOT NULL, col1_9 VARCHAR NOT NULL, col1_10 REGCLASS NULL, PRIMARY KEY (col1_7 ASC, col1_8 DESC, col1_9 DESC, col1_5, col1_1 DESC), INDEX (col1_6 ASC, col1_4 ASC), INVERTED INDEX (col1_4, col1_10 ASC, col1_5 ASC, col1_2 DESC, col1_9, col1_7, col1_1 DESC, col1_3 ASC));
        CREATE TABLE table2 (col1_7 "char" NOT NULL, col1_8 BYTES NOT NULL, col1_9 VARCHAR NOT NULL, col1_5 "char" NOT NULL, col1_1 REGPROC NOT NULL, col2_5 OID, col2_6 UUID, col2_7 OID NULL, col2_8 REGPROC, col2_9 STRING NOT NULL, col2_10 INTERVAL NOT NULL, col2_11 STRING NOT NULL, col2_12 VARCHAR NULL, col2_13 REGPROC NULL, col2_14 REGCLASS, col2_15 BIT(25), col2_16 REGPROCEDURE NULL, col2_17 BIT(7) NOT NULL, col2_18 INET NOT NULL, col2_19 UUID, PRIMARY KEY (col1_7 ASC, col1_8 DESC, col1_9 DESC, col1_5, col1_1 DESC, col2_9 ASC, col2_14 DESC, col2_18, col2_15 ASC, col2_13, col2_16, col2_5, col2_7, col2_19 DESC, col2_10 ASC, col2_6 ASC, col2_8 DESC, col2_17 DESC), INDEX (col2_11, col2_17, col1_1 ASC, col2_7 ASC, col2_9 ASC, col2_19, col2_15 DESC), UNIQUE (col2_10 ASC, col1_5 DESC, col2_16 DESC, col2_6, col2_7) WHERE (((((table2.col1_8 != '\xe29883':::BYTES) OR (table2.col2_9 >= '"':::STRING)) AND (table2.col1_5 != '"':::STRING)) AND (table2.col2_11 <= '"':::STRING)) OR (table2.col1_9 < e'\x00':::STRING)) AND (table2.col1_7 != '':::STRING), UNIQUE (col2_7 DESC, col2_14, col2_12 ASC, col1_1 ASC, col1_5 DESC, col1_8 ASC, col2_9 DESC, col2_13, col1_9 ASC, col2_11 ASC), INDEX (col2_13 DESC, col2_19, col2_10 ASC, col2_6 DESC, col2_5 DESC, col2_11 ASC), FAMILY (col2_7), FAMILY (col1_7, col2_14), FAMILY (col2_16), FAMILY (col2_6, col2_11, col1_5, col1_8), FAMILY (col2_13, col1_1, col2_8, col2_18, col2_19), FAMILY (col2_9), FAMILY (col2_10), FAMILY (col2_12, col1_9, col2_5), FAMILY (col2_17, col2_15), UNIQUE (col1_1)) INTERLEAVE IN PARENT table1 (col1_7, col1_8, col1_9, col1_5, col1_1);
        ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 44327681, "histo_col_type": "", "name": "__auto__", "null_count": 1945129, "row_count": 70000000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2304523, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3087230, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 23117359, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000}, {"columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 12117609, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 36811186, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 23521451, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000}, {"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 55457084, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 70000000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 50936031, "histo_buckets": [{"distinct_range": 0, "num_eq": 500, "num_range": 0, "upper_bound": "\\u0000"}], "histo_col_type": "\\"char\\"", "name": "__auto__", "null_count": 0, "row_count": 70000000}, {"columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 31097194, "histo_col_type": "", "name": "__auto__", "null_count": 63531982, "row_count": 70000000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 47910912, "histo_col_type": "", "name": "__auto__", "null_count": 48136411, "row_count": 70000000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 572303215, "histo_buckets": [{"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "938457656"}, {"distinct_range": 500, "num_eq": 80, "num_range": 500, "upper_bound": "1451221160"}, {"distinct_range": 0, "num_eq": 500000000, "num_range": 0, "upper_bound": "1521160330"}, {"distinct_range": 0, "num_eq": 90000, "num_range": 10, "upper_bound": "3230474308"}, {"distinct_range": 200000000, "num_eq": 5858773986437425197, "num_range": 200000000, "upper_bound": "3269155518"}, {"distinct_range": 7966.753109820265, "num_eq": 300000, "num_range": 10000, "upper_bound": "3405114765"}, {"distinct_range": 0, "num_eq": 1697381850704396482, "num_range": 800000000, "upper_bound": "4059138340"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 1521594456, "row_count": 9000000000}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8728976853, "histo_col_type": "", "name": "__auto__", "null_count": 5231859554, "row_count": 9000000000}, {"columns": ["col2_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8806464557, "histo_col_type": "", "name": "__auto__", "null_count": 7256447474, "row_count": 9000000000}, {"columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6611016188, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4983891867, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3864486607, "histo_col_type": "", "name": "__auto__", "null_count": 6789729985, "row_count": 9000000000}, {"columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5154470597, "histo_buckets": [{"distinct_range": 0, "num_eq": 5093696969817341937, "num_range": 0, "upper_bound": ""}, {"distinct_range": 0, "num_eq": 4721294923093716958, "num_range": 90, "upper_bound": "\\u00051"}, {"distinct_range": 253854775.20119673, "num_eq": 2650619551201098841, "num_range": 6000000000, "upper_bound": "\\u000cKD\\u0012"}, {"distinct_range": 0, "num_eq": 4000, "num_range": 0, "upper_bound": "\\u0016\\u001ew>R8\\u0018"}, {"distinct_range": 5524798439516603000, "num_eq": 7487203008940341107, "num_range": 5524798439516603504, "upper_bound": "\\u00188c\\"}vY"}, {"distinct_range": 0, "num_eq": 4019967249723577673, "num_range": 8605028620579205134, "upper_bound": "9\\u0018P\\u001fs%b8"}, {"distinct_range": 1107280008068624000, "num_eq": 2000, "num_range": 2225322927849420566, "upper_bound": "N\\u001a\\u000cv\\u001dO"}, {"distinct_range": 0, "num_eq": 700, "num_range": 0, "upper_bound": "]LN9\\u001e;a{b"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col2_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3637933840, "histo_col_type": "", "name": "__auto__", "null_count": 7653867311, "row_count": 9000000000}, {"columns": ["col2_19"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 690136997, "histo_col_type": "", "name": "__auto__", "null_count": 7553613958, "row_count": 9000000000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3199690360, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4399034117, "histo_col_type": "", "name": "__auto__", "null_count": 1513420326, "row_count": 9000000000}, {"columns": ["col2_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8426835711, "histo_col_type": "", "name": "__auto__", "null_count": 993364490, "row_count": 9000000000}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1417590022, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col2_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3590886457, "histo_buckets": [{"distinct_range": 0, "num_eq": 5621385016102741048, "num_range": 0, "upper_bound": "252968599"}, {"distinct_range": 1036527871389930600, "num_eq": 6875983374639978349, "num_range": 6244309342522223418, "upper_bound": "676292018"}, {"distinct_range": 108742.30333992046, "num_eq": 30, "num_range": 200000, "upper_bound": "1635013710"}, {"distinct_range": 1291212666011798800, "num_eq": 20000000, "num_range": 7368460871934104381, "upper_bound": "2659669858"}, {"distinct_range": 0, "num_eq": 10000, "num_range": 8000, "upper_bound": "2732016709"}, {"distinct_range": 0, "num_eq": 4409127679827079342, "num_range": 80000, "upper_bound": "2832947975"}], "histo_col_type": "REGPROC", "name": "__auto__", "null_count": 4365705760, "row_count": 9000000000}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3565164016, "histo_buckets": [{"distinct_range": 0, "num_eq": 90000000000, "num_range": 0, "upper_bound": "-41 years -6 mons -979 days -22:27:58.665648"}, {"distinct_range": 7033578598244517000, "num_eq": 900, "num_range": 7033578598244516945, "upper_bound": "-29 years -850 days -17:56:57.855042"}], "histo_col_type": "INTERVAL", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col2_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3344419927, "histo_col_type": "", "name": "__auto__", "null_count": 5051393127, "row_count": 9000000000}, {"columns": ["col2_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8965410803, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col2_18"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6268441418, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7337855410, "histo_buckets": [{"distinct_range": 0, "num_eq": 3506510607308064531, "num_range": 0, "upper_bound": "4"}, {"distinct_range": 90, "num_eq": 3253637800702880241, "num_range": 90, "upper_bound": "F"}], "histo_col_type": "\\"char\\"", "name": "__auto__", "null_count": 0, "row_count": 9000000000}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3280327956, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 9000000000}]':::JSONB;
        ALTER TABLE table1 ADD FOREIGN KEY (col1_1) REFERENCES table2 (col1_1) ON DELETE CASCADE;
        CREATE TYPE rand_typ_0 AS ENUM ('fdjwjx', 'xx');
        CREATE TYPE rand_typ_1 AS ENUM ('vfpt', 'jfeioi', 'omyugh');
        CREATE TYPE rand_typ_2 AS ENUM ('odswy', 'mno');
        CREATE TYPE rand_typ_3 AS ENUM ('kzs', 'v', 'kdw', 'gkllh');
        CREATE TYPE rand_typ_4 AS ENUM ('e', 'iqphtx', 'w');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith831988652
--- FAIL: TestRandomSyntaxSQLSmith (300.88s)
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 @rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

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

        SET enable_drop_enum_value = true;
        
        		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 INTERVAL NOT NULL, col1_1 INT4 NOT NULL, col1_2 INT4 NOT NULL, col1_3 INT4 NOT NULL, col1_4 TIMESTAMPTZ NOT NULL, col1_5 FLOAT4 NOT NULL, col1_6 TIMETZ NOT NULL, col1_7 TIMESTAMP NULL, col1_8 DATE NOT NULL, PRIMARY KEY (col1_2, col1_6, col1_3 ASC, col1_1 DESC, col1_5, col1_0, col1_4 DESC, col1_8 ASC), col1_9 FLOAT4 NOT NULL AS (col1_5 + (-2.5920708179473877):::FLOAT8) STORED, col1_10 STRING NOT NULL AS (lower(CAST(col1_8 AS STRING))) STORED, col1_11 INT4 AS (col1_1 + col1_2) VIRTUAL, col1_12 STRING NOT NULL AS (lower(CAST(col1_0 AS STRING))) VIRTUAL, col1_13 INT4 NOT NULL AS ((col1_2 + col1_1) + col1_3) VIRTUAL, col1_14 INT4 NOT NULL AS (col1_1 + 2095651606:::INT8) STORED, col1_15 STRING NOT NULL AS (lower(CAST(col1_0 AS STRING))) STORED, col1_16 INT4 NULL AS ((col1_2 + col1_3) + col1_1) STORED, UNIQUE (col1_2, col1_3, col1_5 DESC, col1_15 DESC, col1_16, col1_12 DESC, col1_0 ASC, col1_8 ASC, col1_7 ASC, col1_9 DESC, col1_11 DESC, col1_13 DESC, col1_6), INDEX (col1_4, col1_1, col1_11, col1_7 DESC, col1_10, col1_9 DESC, col1_13 ASC, col1_15 ASC, col1_2, col1_6 DESC, col1_5 ASC, col1_0 DESC) STORING (col1_16) WHERE (((((((((((table1.col1_16 = 127:::INT8) AND (table1.col1_5 != 1.0:::FLOAT8)) OR (table1.col1_6 <= '24:00:00-15:59:00':::TIMETZ)) AND (table1.col1_14 <= 0:::INT8)) OR (table1.col1_3 >= 2147483647:::INT8)) OR (table1.col1_7 != '294276-12-31 23:59:59.999999':::TIMESTAMP)) AND (table1.col1_12 < 'X':::STRING)) OR (table1.col1_11 <= (-32768):::INT8)) AND (table1.col1_8 < '5874897-12-31':::DATE)) OR (table1.col1_10 < 'X':::STRING)) AND (table1.col1_13 <= (-128):::INT8)) AND (table1.col1_9 = 1.401298464324817e-45:::FLOAT8), INDEX (col1_14 DESC, col1_7, col1_4 DESC, col1_8, col1_1 DESC, col1_10 ASC, col1_11 DESC) WHERE (((((((((((((((table1.col1_11 = 127:::INT8) AND (table1.col1_4 = '-4713-11-24 00:00:00+00:00':::TIMESTAMPTZ)) OR (table1.col1_14 > 127:::INT8)) AND (table1.col1_9 = '-Inf':::FLOAT8)) OR (table1.col1_3 <= 2147483647:::INT8)) OR (table1.col1_8 > '4714-11-24 BC':::DATE)) OR (table1.col1_5 != 0.0:::FLOAT8)) OR (table1.col1_2 <= 1:::INT8)) AND (table1.col1_6 > '24:00:00-15:59:00':::TIMETZ)) OR (table1.col1_1 >= 1:::INT8)) AND (table1.col1_7 <= '-4713-11-24 00:00:00':::TIMESTAMP)) OR (table1.col1_16 < 32767:::INT8)) AND (table1.col1_13 != 1:::INT8)) AND (table1.col1_15 < 'X':::STRING)) AND (table1.col1_10 <= 'X':::STRING)) AND (table1.col1_12 > e'\x00':::STRING), UNIQUE (col1_15 ASC, col1_8 DESC, col1_10 DESC, col1_4 DESC, col1_11 DESC, col1_16 DESC, col1_12 ASC, col1_14 ASC, col1_3 DESC, col1_2 ASC, col1_0 ASC), UNIQUE (col1_4 ASC, col1_9 ASC, col1_5, col1_12 ASC, col1_2 DESC, col1_3 DESC, col1_0, col1_1, col1_10 DESC, col1_13, col1_11 DESC, col1_6 ASC) WHERE ((table1.col1_12 = '"':::STRING) AND (table1.col1_14 < (-2147483648):::INT8)) OR (table1.col1_15 < '':::STRING), INDEX (col1_0, col1_5, col1_1 DESC, col1_4 ASC, col1_14 DESC, col1_16, col1_12 DESC, col1_7 DESC, col1_6 DESC) STORING (col1_15) WHERE ((((((((((((((table1.col1_11 != (-1):::INT8) OR (table1.col1_12 < '"':::STRING)) OR (table1.col1_13 < 1:::INT8)) AND (table1.col1_9 = 1.0:::FLOAT8)) AND (table1.col1_7 > '294276-12-31 23:59:59.999999':::TIMESTAMP)) OR (table1.col1_16 != (-1):::INT8)) OR (table1.col1_8 != '5874897-12-31':::DATE)) AND (table1.col1_4 > '3000-01-01 00:00:00+00:00':::TIMESTAMPTZ)) AND (table1.col1_3 <= 127:::INT8)) OR (table1.col1_10 < '':::STRING)) OR (table1.col1_6 != '24:00:00-15:59:00':::TIMETZ)) OR (table1.col1_15 > '"':::STRING)) AND (table1.col1_2 = 2147483647:::INT8)) AND (table1.col1_1 = (-1):::INT8)) OR (table1.col1_5 >= 1.401298464324817e-45:::FLOAT8), FAMILY (col1_3), FAMILY (col1_10), FAMILY (col1_8, col1_1), FAMILY (col1_16), FAMILY (col1_4, col1_14, col1_5), FAMILY (col1_15, col1_9, col1_2), FAMILY (col1_6, col1_7, col1_0));
        CREATE TABLE table2 (col2_0 TIMESTAMP NOT NULL, col2_1 INTERVAL NOT NULL, col2_2 FLOAT8 NOT NULL, col2_3 BIT(16) NULL, col2_4 TIMESTAMPTZ, col2_5 INET NOT NULL, col2_6 TIMESTAMPTZ NOT NULL, col2_7 BOOL NOT NULL, col2_8 REGNAMESPACE NOT NULL, PRIMARY KEY (col2_8, col2_1 DESC, col2_6 ASC, col2_2), col2_9 STRING NOT NULL AS (lower(CAST(col2_5 AS STRING))) STORED, col2_10 STRING AS (CASE WHEN col2_4 IS NULL THEN e'\'sZ\x01s\x04s':::STRING ELSE e'\x02SW/':::STRING END) STORED, col2_11 FLOAT8 NOT NULL AS (col2_2 + (-1.3789710587263158):::FLOAT8) VIRTUAL, UNIQUE (col2_6, col2_3 ASC, col2_0 DESC, col2_2), INDEX (col2_8 DESC, col2_4, col2_1, col2_7, col2_10 ASC, col2_9 ASC, col2_3, col2_11, col2_0 ASC, col2_2) STORING (col2_5), INDEX (col2_8 DESC, col2_3 DESC, col2_1 ASC, col2_4, col2_10, col2_9, col2_6 DESC) WHERE (((((((table2.col2_6 > '294276-12-31 23:59:59.999999+00:00':::TIMESTAMPTZ) OR (table2.col2_10 < '':::STRING)) OR (table2.col2_0 > '-4713-11-24 00:00:00':::TIMESTAMP)) OR (table2.col2_11 >= (-1.0):::FLOAT8)) AND (table2.col2_9 = e'\U00002603':::STRING)) OR table2.col2_7) OR (table2.col2_4 >= '-2000-01-01 00:00:00+00:00':::TIMESTAMPTZ)) OR (table2.col2_2 >= 'NaN':::FLOAT8), INDEX (col2_7 ASC, col2_6 DESC, col2_10 ASC, col2_2, col2_0 DESC, col2_8 ASC, col2_11), UNIQUE (col2_5 DESC, col2_10 ASC, col2_2, col2_1 DESC, col2_11 DESC) STORING (col2_3) WHERE table2.col2_10 != '"':::STRING, UNIQUE (col2_9, col2_4, col2_10 DESC, col2_8 ASC, col2_3 ASC, col2_2, col2_1 DESC, col2_0 DESC, col2_6 DESC, col2_7 DESC, col2_11) STORING (col2_5), INDEX (col2_4, col2_1 DESC, col2_3, col2_7 DESC, col2_10 DESC, col2_0, col2_5, col2_8 ASC, col2_11, col2_9, col2_6) WHERE NOT table2.col2_7);
        ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1891270337541820935, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1975997065150926523, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2352043406882310297, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 209054013281798279, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2123937017285652710, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2321857142421488615, "histo_col_type": "", "name": "__auto__", "null_count": 2014042573209158612, "row_count": 3257688161118020297}, {"columns": ["col1_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1518486293287693824, "histo_buckets": [{"distinct_range": 0, "num_eq": 40000000, "num_range": 0, "upper_bound": "-1100474869"}, {"distinct_range": 5175008785300864, "num_eq": 1544165889218143111, "num_range": 217908407010656186, "upper_bound": "-32768"}, {"distinct_range": 5359026519864102000, "num_eq": 6738817470715487121, "num_range": 5359026519864102378, "upper_bound": "2081518098"}], "histo_col_type": "INT4", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2717473320518405985, "histo_buckets": [{"distinct_range": 0, "num_eq": 8699919275681983649, "num_range": 0, "upper_bound": "1974-01-17 11:53:34.000979+00:00"}, {"distinct_range": 10000000, "num_eq": 100000000000, "num_range": 10000000, "upper_bound": "1979-07-21 16:56:37.000787+00:00"}, {"distinct_range": 0, "num_eq": 4109852924290269787, "num_range": 0, "upper_bound": "1985-04-07 15:36:42.000612+00:00"}, {"distinct_range": 3492175378592124400, "num_eq": 2000, "num_range": 3492175378592124435, "upper_bound": "1999-10-09 23:25:59.000738+00:00"}], "histo_col_type": "TIMESTAMPTZ", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 856966446062686414, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 467414442856429281, "histo_buckets": [{"distinct_range": 0, "num_eq": 9145664297930557308, "num_range": 0, "upper_bound": "(qn;=(\\u0014"}, {"distinct_range": 135360131.93497866, "num_eq": 4829113762709095134, "num_range": 400000000, "upper_bound": "+$\\u0012"}, {"distinct_range": 424.1360857622505, "num_eq": 8105152370842833940, "num_range": 5000, "upper_bound": "\U00002603"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2364243561586930803, "histo_col_type": "", "name": "__auto__", "null_count": 265191124991721125, "row_count": 3257688161118020297}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 673737084498478450, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2281934728244046196, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1314644435622115068, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 135518859421754077, "histo_col_type": "", "name": "__auto__", "null_count": 683823562847965922, "row_count": 3257688161118020297}, {"columns": ["col1_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1900807767345183110, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}, {"columns": ["col1_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3060080288349261280, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3257688161118020297}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1910, "histo_col_type": "", "name": "__auto__", "null_count": 5247, "row_count": 6000}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2260, "histo_buckets": [{"distinct_range": 0, "num_eq": 10000000000, "num_range": 0, "upper_bound": "1991-05-31 10:04:58.000848+00:00"}, {"distinct_range": 0, "num_eq": 1835070442404356840, "num_range": 6851218115728088710, "upper_bound": "2028-02-11 19:52:33.000669+00:00"}], "histo_col_type": "TIMESTAMPTZ", "name": "__auto__", "null_count": 1162, "row_count": 6000}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1455, "histo_buckets": [{"distinct_range": 0, "num_eq": 2000, "num_range": 0, "upper_bound": "244.196.221.255/12"}], "histo_col_type": "INET", "name": "__auto__", "null_count": 0, "row_count": 6000}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2491, "histo_buckets": [{"distinct_range": 0, "num_eq": 700000, "num_range": 0, "upper_bound": "-4713-11-24 00:00:00+00:00"}, {"distinct_range": 10000000, "num_eq": 200000, "num_range": 10000000, "upper_bound": "-2000-01-01 00:00:00+00:00"}, {"distinct_range": 0, "num_eq": 10000000000, "num_range": 40000000, "upper_bound": "1970-02-05 15:58:05.000779+00:00"}, {"distinct_range": 3475221200354754600, "num_eq": 794111822899739672, "num_range": 3475221200354754469, "upper_bound": "1983-02-18 20:47:55.000597+00:00"}, {"distinct_range": 3176311930884888000, "num_eq": 881345911270375977, "num_range": 3176311930884888316, "upper_bound": "1983-03-14 00:37:41.000588+00:00"}, {"distinct_range": 60, "num_eq": 8000000, "num_range": 60, "upper_bound": "2010-04-20 13:21:14.000039+00:00"}, {"distinct_range": 0, "num_eq": 8239885767273606136, "num_range": 300000, "upper_bound": "2013-10-12 13:11:21.000863+00:00"}, {"distinct_range": 90, "num_eq": 4405036922172169774, "num_range": 90, "upper_bound": "2026-11-02 13:42:57.000991+00:00"}, {"distinct_range": 10.178632677382566, "num_eq": 0, "num_range": 30, "upper_bound": "2031-08-17 11:24:03.000995+00:00"}], "histo_col_type": "TIMESTAMPTZ", "name": "__auto__", "null_count": 0, "row_count": 6000}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5602, "histo_buckets": [{"distinct_range": 0, "num_eq": 3000000, "num_range": 0, "upper_bound": "false"}, {"distinct_range": 6480510263952591000, "num_eq": 40000, "num_range": 6480510263952591201, "upper_bound": "true"}], "histo_col_type": "BOOL", "name": "__auto__", "null_count": 0, "row_count": 6000}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3736, "histo_buckets": [{"distinct_range": 0, "num_eq": 100000, "num_range": 0, "upper_bound": "216415978"}, {"distinct_range": 817688.6402514691, "num_eq": 900000000, "num_range": 1000000, "upper_bound": "2078136714"}, {"distinct_range": 0, "num_eq": 9000000000, "num_range": 6808866888734808424, "upper_bound": "2857525856"}, {"distinct_range": 1066506609.5246496, "num_eq": 200000000, "num_range": 10000000000, "upper_bound": "2863823837"}, {"distinct_range": 20, "num_eq": 3000, "num_range": 20, "upper_bound": "3744429257"}, {"distinct_range": 500, "num_eq": 9000, "num_range": 500, "upper_bound": "3930050603"}], "histo_col_type": "REGNAMESPACE", "name": "__auto__", "null_count": 0, "row_count": 6000}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5748, "histo_col_type": "", "name": "__auto__", "null_count": 3676, "row_count": 6000}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5654, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6000}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5638, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6000}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5024, "histo_buckets": [{"distinct_range": 0, "num_eq": 500000, "num_range": 0, "upper_bound": "\\u0012\\u0004KJ[G= "}, {"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "9"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 6000}, {"columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 351, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6000}, {"columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4318, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('niarl', 'tk');
        CREATE TYPE rand_typ_1 AS ENUM ('xjcebm', 'xl', 'o');
        CREATE TYPE rand_typ_2 AS ENUM ('rgo', 'lushxk');
        CREATE TYPE rand_typ_3 AS ENUM ('oqxn', 'p', 'lthnw', 's', 'j');
        CREATE TYPE rand_typ_4 AS ENUM ('wgb', 'jbi', 'wjpbf', 'aul', 'qz', 'ue');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith181989036
--- FAIL: TestRandomSyntaxSQLSmith (301.32s)
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 @rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

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

        SET enable_drop_enum_value = true;
        
        		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 INT2 NULL, col1_1 TIMESTAMPTZ NOT NULL, col1_2 TIME NULL, col1_3 BIT(33) NULL, col1_4 DATE NOT NULL, col1_5 REGCLASS, col1_6 INET[] NOT NULL, col1_7 BOX2D, col1_8 TIMESTAMPTZ NULL, col1_9 REGCLASS, col1_10 STRING NOT NULL AS (CASE WHEN col1_1 IS NULL THEN '5p':::STRING ELSE e'"\x15\x19.\x04v\x1c1/':::STRING END) VIRTUAL, col1_11 STRING NULL AS (lower(CAST(col1_2 AS STRING))) VIRTUAL, col1_12 STRING NOT NULL AS (CASE WHEN col1_6 IS NULL THEN '':::STRING ELSE e'\x1dc\x0baX]gGV':::STRING END) STORED, col1_13 STRING NOT NULL AS (CASE WHEN col1_1 IS NULL THEN e'jZ3QbX\x07\x1cr':::STRING ELSE e'$\\[\x16m\x1b':::STRING END) STORED, col1_14 STRING NOT NULL AS (CASE WHEN col1_1 IS NULL THEN e'\x01r6\x15':::STRING ELSE e',D9\r\x1c':::STRING END) STORED, col1_15 STRING NOT NULL AS (CASE WHEN col1_6 IS NULL THEN '"':::STRING ELSE e'tqV\x13t=E\x13':::STRING END) VIRTUAL, UNIQUE (col1_9, col1_5, col1_15 DESC, col1_8 ASC, col1_3 DESC, col1_4 DESC, col1_11 ASC));
        CREATE TABLE table2 (col2_0 REGTYPE NOT NULL, col2_1 FLOAT8 NULL, col2_2 BIT(9) NULL, col2_3 FLOAT8, col2_4 REGCLASS NULL, col2_5 INT4 NULL, col2_6 INT8, col2_7 INT4 NOT NULL, col2_8 OID, col2_9 TIMESTAMPTZ NULL, col2_10 BYTES NOT NULL, col2_11 REGCLASS, col2_12 FLOAT8 AS (col2_3 + col2_1) STORED, UNIQUE (col2_6, col2_12, col2_3 ASC, col2_2 DESC, col2_1 ASC, col2_9 DESC, col2_11 DESC) WHERE (((table2.col2_10 >= '\xff':::BYTES) AND (table2.col2_3 >= 5e-324:::FLOAT8)) AND (table2.col2_1 <= 0.0:::FLOAT8)) OR (table2.col2_9 <= '0001-01-01 00:00:00+00:00':::TIMESTAMPTZ), UNIQUE (col2_1 ASC, col2_9 ASC, col2_7 DESC, col2_5, col2_0 DESC, col2_4 DESC), UNIQUE (col2_10, col2_1 DESC, col2_8 ASC, col2_9 DESC) WHERE ((((((table2.col2_10 <= '\x22':::BYTES) OR (table2.col2_6 < (-2147483648):::INT8)) OR (table2.col2_7 <= 1:::INT8)) OR (table2.col2_9 > '0001-01-01 00:00:00+00:00':::TIMESTAMPTZ)) OR (table2.col2_12 < (-1.0):::FLOAT8)) AND (table2.col2_1 != 1.401298464324817e-45:::FLOAT8)) OR (table2.col2_5 <= (-2147483648):::INT8), INDEX (col2_4, col2_6, col2_3, col2_9, col2_2 ASC, col2_12) STORING (col2_5, col2_7, col2_8, col2_10, col2_11), FAMILY (col2_4, col2_10), FAMILY (col2_8), FAMILY (col2_0), FAMILY (col2_3), FAMILY (col2_7, col2_11), FAMILY (col2_9, col2_12, col2_1), FAMILY (col2_6, col2_5), FAMILY (col2_2));
        ALTER TABLE table1 INJECT STATISTICS '[{"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5212257076953263376, "histo_col_type": "", "name": "__auto__", "null_count": 6444762056207286428, "row_count": 6774516003136060955}, {"columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3923115926470307109, "histo_buckets": [{"distinct_range": 0, "num_eq": 800, "num_range": 0, "upper_bound": "1028929861"}, {"distinct_range": 5000, "num_eq": 4788667498864411199, "num_range": 5000, "upper_bound": "1846349851"}, {"distinct_range": 0, "num_eq": 6773078802796873115, "num_range": 2000000000, "upper_bound": "1997830813"}, {"distinct_range": 243104.0836435235, "num_eq": 30000000000, "num_range": 500000, "upper_bound": "2105039833"}, {"distinct_range": 3562954710202839000, "num_eq": 731297552507926472, "num_range": 5229796711489053183, "upper_bound": "3584161319"}, {"distinct_range": 600000, "num_eq": 300000, "num_range": 600000, "upper_bound": "4165290787"}, {"distinct_range": 6063139437787936000, "num_eq": 200000, "num_range": 6063139437787935333, "upper_bound": "4217197489"}], "histo_col_type": "REGCLASS", "name": "__auto__", "null_count": 6702015212717276426, "row_count": 6774516003136060955}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6129246221132349659, "histo_col_type": "", "name": "__auto__", "null_count": 6088591999852186598, "row_count": 6774516003136060955}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3366539974256248196, "histo_col_type": "", "name": "__auto__", "null_count": 959932184177574581, "row_count": 6774516003136060955}, {"columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2236388609344774731, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6774516003136060955}, {"columns": ["col1_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4937707815690217883, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6774516003136060955}, {"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 46587586844046852, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6774516003136060955}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6155673623527724223, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6774516003136060955}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5700273130952939337, "histo_col_type": "", "name": "__auto__", "null_count": 4334022883914577900, "row_count": 6774516003136060955}, {"columns": ["col1_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4911638121661504552, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6774516003136060955}, {"columns": ["col1_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2945175063215808421, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6774516003136060955}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4336426801220792437, "histo_col_type": "", "name": "__auto__", "null_count": 3846351576422905511, "row_count": 6774516003136060955}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5959260446410569824, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6774516003136060955}, {"columns": ["col1_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3395926711211109278, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 6774516003136060955}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4662299657882071120, "histo_col_type": "", "name": "__auto__", "null_count": 5349157678524016276, "row_count": 6774516003136060955}, {"columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 479991443265371243, "histo_col_type": "", "name": "__auto__", "null_count": 5730018878998391984, "row_count": 6774516003136060955}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 249419, "histo_col_type": "", "name": "__auto__", "null_count": 139130, "row_count": 500000}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 56644, "histo_buckets": [{"distinct_range": 0, "num_eq": 700000, "num_range": 0, "upper_bound": "-4043280434787714307"}], "histo_col_type": "INT8", "name": "__auto__", "null_count": 53130, "row_count": 500000}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 149901, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 172327, "histo_col_type": "", "name": "__auto__", "null_count": 319567, "row_count": 500000}, {"columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 37163, "histo_col_type": "", "name": "__auto__", "null_count": 354517, "row_count": 500000}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 103422, "histo_col_type": "", "name": "__auto__", "null_count": 256011, "row_count": 500000}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 153145, "histo_buckets": [{"distinct_range": 0, "num_eq": 300000000, "num_range": 0, "upper_bound": "991398638"}, {"distinct_range": 3092667488775970300, "num_eq": 1000000, "num_range": 6604443187284037873, "upper_bound": "1254255828"}, {"distinct_range": 17687812005.983837, "num_eq": 8473964763270939559, "num_range": 100000000000, "upper_bound": "1829712539"}, {"distinct_range": 0, "num_eq": 4072594706065824408, "num_range": 3519986053347438277, "upper_bound": "1940946470"}, {"distinct_range": 300, "num_eq": 0, "num_range": 300, "upper_bound": "2495945124"}, {"distinct_range": 0, "num_eq": 7000000, "num_range": 6000, "upper_bound": "2820999480"}, {"distinct_range": 4684699267737908000, "num_eq": 1496893011165729702, "num_range": 5127725276517127203, "upper_bound": "3196034153"}], "histo_col_type": "REGCLASS", "name": "__auto__", "null_count": 221123, "row_count": 500000}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 453851, "histo_col_type": "", "name": "__auto__", "null_count": 311960, "row_count": 500000}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 259728, "histo_col_type": "", "name": "__auto__", "null_count": 430457, "row_count": 500000}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 455741, "histo_buckets": [{"distinct_range": 0, "num_eq": 2866448982392120361, "num_range": 0, "upper_bound": "\\\\x"}, {"distinct_range": 18717.981029982675, "num_eq": 60, "num_range": 20000, "upper_bound": "\\\\x3bd56bf0"}, {"distinct_range": 5774190259555949000, "num_eq": 6482388909906976771, "num_range": 5774190259555948040, "upper_bound": "\\\\x9ab9bd52"}, {"distinct_range": 0, "num_eq": 30, "num_range": 70, "upper_bound": "\\\\xbb2fb7"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col2_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 276686, "histo_col_type": "", "name": "__auto__", "null_count": 481076, "row_count": 500000}, {"columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 400624, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 119595, "histo_buckets": [{"distinct_range": 0, "num_eq": 4709112721284108614, "num_range": 0, "upper_bound": "-1.1736995868635545"}, {"distinct_range": 2387166514771466000, "num_eq": 7029852119402312296, "num_range": 2396079566890941796, "upper_bound": "-0.21846865832530504"}, {"distinct_range": 3000000, "num_eq": 1647519759474908371, "num_range": 3000000, "upper_bound": "-0.17658809576445567"}, {"distinct_range": 2253176096881908700, "num_eq": 400000000, "num_range": 2253176096881908837, "upper_bound": "1.401298464324817e-45"}, {"distinct_range": 6563540947013351000, "num_eq": 90, "num_range": 6563540947013350930, "upper_bound": "0.3638169615681752"}, {"distinct_range": 19160.823444602534, "num_eq": 7291116697227176837, "num_range": 80000, "upper_bound": "0.8578210397497169"}, {"distinct_range": 700000, "num_eq": 1764776713803109196, "num_range": 700000, "upper_bound": "1.0497079035861088"}, {"distinct_range": 5591825505.243966, "num_eq": 8448721668213332178, "num_range": 40000000000, "upper_bound": "1.4416028661120301"}, {"distinct_range": 1866722037863689000, "num_eq": 6013525621470599759, "num_range": 2968923005016234843, "upper_bound": "+Inf"}], "histo_col_type": "FLOAT8", "name": "__auto__", "null_count": 264539, "row_count": 500000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('guvco');
        CREATE TYPE rand_typ_1 AS ENUM ('n', 'rvl', 'rq');
        CREATE TYPE rand_typ_2 AS ENUM ('ujxeh', 'vfsxv');
        CREATE TYPE rand_typ_3 AS ENUM ('phmp', 'kptz', 'olx');
        CREATE TYPE rand_typ_4 AS ENUM ('zqudtt', 'k', 'qeifm');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith000417270
--- FAIL: TestRandomSyntaxSQLSmith (300.59s)
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 @rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

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

        		SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
        		SET CLUSTER SETTING sql.defaults.interleaved_tables.enabled = true;
        	CREATE TABLE table1 (col1_0 REGTYPE NOT NULL, col1_1 VARCHAR, col1_2 INET, col1_3 INT4 NOT NULL, col1_4 INTERVAL NOT NULL, PRIMARY KEY (col1_3 DESC), col1_5 STRING AS (lower(col1_1)) STORED, col1_6 STRING AS (lower(col1_1)) STORED, col1_7 STRING AS (lower(col1_1)) VIRTUAL, INDEX (col1_6 DESC, col1_4 DESC, col1_3) WHERE ((((table1.col1_5 >= '':::STRING) OR (table1.col1_7 <= '':::STRING)) OR (table1.col1_3 != (-32768):::INT8)) OR (table1.col1_1 = e'\'':::STRING)) AND (table1.col1_6 > e'\'':::STRING), UNIQUE (col1_0 ASC, col1_2 DESC, col1_5 DESC, col1_6, col1_3 ASC, col1_1 ASC), INDEX (col1_7 DESC, col1_4 ASC, col1_0 ASC, col1_3 DESC, col1_6 ASC, col1_1), INDEX (col1_4 ASC, col1_3 ASC, col1_5, col1_7, col1_0 ASC, col1_1) WHERE (table1.col1_6 >= e'\'':::STRING) AND (table1.col1_5 = '':::STRING), UNIQUE (col1_3 ASC, col1_0 DESC, col1_2 ASC), INDEX (col1_7 DESC, col1_0 DESC, col1_4 ASC), UNIQUE (col1_4 ASC, col1_0), INDEX (col1_3 ASC, col1_7 ASC, col1_2 DESC) WHERE ((((table1.col1_5 < e'\'':::STRING) OR (table1.col1_3 < (-128):::INT8)) AND (table1.col1_1 <= e'\'':::STRING)) AND (table1.col1_7 < e'\'':::STRING)) AND (table1.col1_6 > 'X':::STRING));
        CREATE TABLE table2 (col2_0 INTERVAL NULL, col2_1 BYTES, col2_2 GEOGRAPHY, col2_3 GEOMETRY, col2_4 TIMESTAMP, col2_5 INET, col2_6 INET, col2_7 NAME NOT NULL, col2_8 UUID NULL, col2_9 FLOAT4 NULL, col2_10 REGCLASS NOT NULL, col2_11 BOX2D NOT NULL, col2_12 REGTYPE, col2_13 REGTYPE NULL, col2_14 DATE NOT NULL, col2_15 BOOL, col2_16 BYTES NULL, col2_17 STRING NOT NULL AS (lower(CAST(col2_10 AS STRING))) STORED, INVERTED INDEX (col2_17, col2_12 DESC, col2_13, col2_10, col2_4 DESC, col2_7 DESC, col2_2), INDEX (col2_0 DESC, col2_15 DESC, col2_10 DESC, col2_16, col2_13) WHERE (((((table2.col2_4 >= '294276-12-31 23:59:59.999999':::TIMESTAMP) OR (table2.col2_7 > '"':::STRING)) AND (table2.col2_16 = '\x22':::BYTES)) AND (table2.col2_17 <= e'\x00':::STRING)) OR (table2.col2_1 != '\x22':::BYTES)) AND (table2.col2_14 >= '1970-01-01':::DATE), UNIQUE (col2_0, col2_10, col2_5));
        CREATE TABLE table3 (col3_0 TIMESTAMP NOT NULL, col3_1 INT2 NOT NULL, col3_2 REGPROCEDURE NOT NULL, col3_3 REGTYPE NOT NULL, col3_4 UUID NOT NULL, PRIMARY KEY (col3_3, col3_0 ASC, col3_4, col3_1 DESC, col3_2), col3_5 STRING NOT NULL AS (lower(CAST(col3_3 AS STRING))) VIRTUAL, col3_6 STRING NOT NULL AS (lower(CAST(col3_4 AS STRING))) VIRTUAL, FAMILY (col3_3, col3_0), FAMILY (col3_1, col3_4), FAMILY (col3_2));
        ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1045260710935583515, "histo_buckets": [{"distinct_range": 0, "num_eq": 6900949158688993053, "num_range": 0, "upper_bound": "-45 years -9 mons -670 days -21:57:51.114986"}, {"distinct_range": 4337756066.150041, "num_eq": 200000, "num_range": 30000000000, "upper_bound": "00:00:00"}, {"distinct_range": 0, "num_eq": 300000000, "num_range": 4616732386244040698, "upper_bound": "30 years 11 mons 466 days 01:53:30.444225"}, {"distinct_range": 28336000386.965878, "num_eq": 1000000000, "num_range": 40000000000, "upper_bound": "51 years 1 mon 540 days 23:43:33.378299"}, {"distinct_range": 1952505039414741000, "num_eq": 10000000000, "num_range": 5771606923837495891, "upper_bound": "52 years 7 mons 103 days 12:10:10.988895"}], "histo_col_type": "INTERVAL", "name": "__auto__", "null_count": 0, "row_count": 1475799507929221980}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1189874297928791381, "histo_col_type": "", "name": "__auto__", "null_count": 920509745385141221, "row_count": 1475799507929221980}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 579397094317681616, "histo_buckets": [{"distinct_range": 0, "num_eq": 8074904149881423049, "num_range": 0, "upper_bound": "q\\u0001f[h"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 1346517471476125572, "row_count": 1475799507929221980}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 435472155621959735, "histo_buckets": [{"distinct_range": 0, "num_eq": 7823847594415419154, "num_range": 0, "upper_bound": ""}, {"distinct_range": 0, "num_eq": 8843327470855469785, "num_range": 0, "upper_bound": "\\u0015H~+[x3"}, {"distinct_range": 6543428031.384468, "num_eq": 6879233900746644693, "num_range": 7000000000, "upper_bound": " S\\u000f8:dv\\u000eA"}, {"distinct_range": 61016498.83339696, "num_eq": 80, "num_range": 70000000, "upper_bound": "\\""}, {"distinct_range": 0, "num_eq": 10000, "num_range": 0, "upper_bound": "+lMu "}, {"distinct_range": 2808755633.6938424, "num_eq": 60000, "num_range": 30000000000, "upper_bound": "t6h>&.P"}, {"distinct_range": 0, "num_eq": 700000, "num_range": 6902366030048552704, "upper_bound": "{\\u0015\\u001b\\u0018rI"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 287679896602322050, "row_count": 1475799507929221980}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1178412590730751861, "histo_buckets": [{"distinct_range": 0, "num_eq": 1000000000, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 80.19655526670869, "num_eq": 5000, "num_range": 100, "upper_bound": "498485213"}, {"distinct_range": 1299188430.930193, "num_eq": 6316179309346374170, "num_range": 10000000000, "upper_bound": "1001433416"}, {"distinct_range": 0, "num_eq": 90, "num_range": 10000, "upper_bound": "1695678539"}, {"distinct_range": 8386560588073383000, "num_eq": 20, "num_range": 8386560588073382516, "upper_bound": "2733328477"}, {"distinct_range": 1154664206887902000, "num_eq": 70, "num_range": 5085036393330025525, "upper_bound": "3269074975"}, {"distinct_range": 0, "num_eq": 200000, "num_range": 200, "upper_bound": "3928551281"}], "histo_col_type": "REGTYPE", "name": "__auto__", "null_count": 0, "row_count": 1475799507929221980}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 610170093255312767, "histo_col_type": "", "name": "__auto__", "null_count": 130133532012478005, "row_count": 1475799507929221980}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1175043960489939823, "histo_col_type": "", "name": "__auto__", "null_count": 606210906570251825, "row_count": 1475799507929221980}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1201111696582184178, "histo_buckets": [{"distinct_range": 0, "num_eq": 8799217333516953439, "num_range": 0, "upper_bound": "697071828"}, {"distinct_range": 593546625142757900, "num_eq": 1182580818126192195, "num_range": 904908734158300236, "upper_bound": "867518795"}, {"distinct_range": 7803558876602855000, "num_eq": 800000000, "num_range": 7803558876602855325, "upper_bound": "1302256731"}, {"distinct_range": 4937617845560126000, "num_eq": 929525606957616283, "num_range": 4937617845560126035, "upper_bound": "1343097097"}], "histo_col_type": "INT4", "name": "__auto__", "null_count": 0, "row_count": 1475799507929221980}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2389790953184791605, "histo_buckets": [{"distinct_range": 0, "num_eq": 10000, "num_range": 0, "upper_bound": "-56 years -11 mons -189 days -07:12:17.464227"}, {"distinct_range": 0, "num_eq": 1232482095797815396, "num_range": 7000, "upper_bound": "-34 years -8 mons -331 days -08:47:31.820956"}, {"distinct_range": 0, "num_eq": 100000000, "num_range": 2000000000, "upper_bound": "00:00:00"}, {"distinct_range": 436.0758431690817, "num_eq": 80000000000, "num_range": 3000, "upper_bound": "1 day"}, {"distinct_range": 0, "num_eq": 8365822090219858357, "num_range": 500000, "upper_bound": "22 years 10 mons 617 days 20:41:02.950467"}, {"distinct_range": 573327237217962050, "num_eq": 8924221750129175958, "num_range": 5240465727953306878, "upper_bound": "36 years 11 mons 76 days 14:32:34.119809"}, {"distinct_range": 6390071922421266000, "num_eq": 10000, "num_range": 6390071922421266515, "upper_bound": "58 years 1 mon 334 days 10:55:03.553119"}, {"distinct_range": 600, "num_eq": 80, "num_range": 600, "upper_bound": "60 years 2 mons 93 days 18:11:28.428639"}, {"distinct_range": 2129961038602953700, "num_eq": 400000000, "num_range": 4487742690862188114, "upper_bound": "59 years 11 mons 472 days 23:28:43.69922"}], "histo_col_type": "INTERVAL", "name": "__auto__", "null_count": 1099590794374028148, "row_count": 8396611030450016256}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4748092445911620087, "histo_col_type": "", "name": "__auto__", "null_count": 5144184208889825606, "row_count": 8396611030450016256}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5318687455048446313, "histo_col_type": "", "name": "__auto__", "null_count": 3966462687180732984, "row_count": 8396611030450016256}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5670425386618362185, "histo_col_type": "", "name": "__auto__", "null_count": 6825658452742250030, "row_count": 8396611030450016256}, {"columns": ["col2_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 945051596940261258, "histo_col_type": "", "name": "__auto__", "null_count": 1014076677115521437, "row_count": 8396611030450016256}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3864488196081010674, "histo_col_type": "", "name": "__auto__", "null_count": 67225195817603023, "row_count": 8396611030450016256}, {"columns": ["col2_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5786492854739590120, "histo_col_type": "", "name": "__auto__", "null_count": 3181081466068245826, "row_count": 8396611030450016256}, {"columns": ["col2_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5468371618437562992, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 8396611030450016256}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2201674682670288470, "histo_col_type": "", "name": "__auto__", "null_count": 4492796593700320455, "row_count": 8396611030450016256}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3449721458108310888, "histo_col_type": "", "name": "__auto__", "null_count": 6084114778878196401, "row_count": 8396611030450016256}, {"columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 28033211508423638, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 8396611030450016256}, {"columns": ["col2_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7840915479098127144, "histo_col_type": "", "name": "__auto__", "null_count": 8369088490242177449, "row_count": 8396611030450016256}, {"columns": ["col2_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5307025132248871059, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 8396611030450016256}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1448666139516862090, "histo_col_type": "", "name": "__auto__", "null_count": 2218019547163822265, "row_count": 8396611030450016256}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 452980283415759119, "histo_col_type": "", "name": "__auto__", "null_count": 4725070626698627593, "row_count": 8396611030450016256}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7176048379294849869, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 8396611030450016256}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1843788450433694926, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 8396611030450016256}, {"columns": ["col2_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4888673083028017469, "histo_col_type": "", "name": "__auto__", "null_count": 5660359410317783465, "row_count": 8396611030450016256}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS '[{"columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 388512671360031629, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7724134880762466354}, {"columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4259431754105292387, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7724134880762466354}, {"columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3676971667075018397, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7724134880762466354}, {"columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3111085330361772329, "histo_buckets": [{"distinct_range": 0, "num_eq": 60000000, "num_range": 0, "upper_bound": "28130950"}, {"distinct_range": 0, "num_eq": 1900904434675881999, "num_range": 900000000, "upper_bound": "2137954954"}, {"distinct_range": 1639832843.3232768, "num_eq": 80, "num_range": 9000000000, "upper_bound": "3025615867"}], "histo_col_type": "REGTYPE", "name": "__auto__", "null_count": 0, "row_count": 7724134880762466354}, {"columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5015284532667760594, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7724134880762466354}, {"columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6219957275203705007, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7724134880762466354}, {"columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2071397201874975391, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 7724134880762466354}]':::JSONB;
        ALTER TABLE table1 ADD FOREIGN KEY (col1_4, col1_0, col1_2) REFERENCES table2 (col2_0, col2_10, col2_5) ON UPDATE RESTRICT;
        CREATE TYPE rand_typ_0 AS ENUM ('j', 'nvdv');
        CREATE TYPE rand_typ_1 AS ENUM ('vf', 'm', 'de', 'oo', 'jwuap', 'b');
        CREATE TYPE rand_typ_2 AS ENUM ('teqm', 'ote', 'i');
        CREATE TYPE rand_typ_3 AS ENUM ('oixk', 'v', 'dnq', 'vj', 'tkfjg', 'lnrh');
        CREATE TYPE rand_typ_4 AS ENUM ('aa', 'kvgt', 'ks', 'glhsgp', 'jrj');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith604895544
--- FAIL: TestRandomSyntaxSQLSmith (300.76s)
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 @rafiss

This test on roachdash | Improve this report!

@mgartner mgartner self-assigned this Apr 27, 2021
@cockroach-teamcity
Copy link
Member Author

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

        	CREATE TABLE table1 (col1_0 BYTES NOT NULL, col1_1 REGNAMESPACE NOT NULL, PRIMARY KEY (col1_1 DESC), INDEX (col1_0 ASC, col1_1 ASC), INDEX (col1_1 ASC, col1_0 DESC) WHERE table1.col1_0 > '\x27':::BYTES, INDEX (col1_1), INDEX (col1_1 DESC, col1_0) WHERE table1.col1_0 <= '\x':::BYTES, UNIQUE (col1_0 DESC) WHERE table1.col1_0 >= '\x58':::BYTES, UNIQUE (col1_0 ASC, col1_1 ASC), INDEX (col1_0 DESC), UNIQUE (col1_0 ASC), UNIQUE (col1_0), UNIQUE (col1_1));
        CREATE TABLE table2 (col1_1 REGNAMESPACE NOT NULL, col2_1 INET, col2_2 OID, col2_3 OID NULL, col2_4 BIT(38), PRIMARY KEY (col1_1 DESC, col2_1 ASC), FAMILY (col2_1), FAMILY (col2_3, col1_1), FAMILY (col2_2, col2_4)) INTERLEAVE IN PARENT table1 (col1_1);
        CREATE TABLE table3 (col3_0 INT2, col3_1 OID NULL, col3_2 REGCLASS NULL, col3_3 REGNAMESPACE NOT NULL, col3_4 STRING[], col3_5 INT2 NOT NULL, col3_6 REGCLASS, col3_7 STRING, col3_8 GEOGRAPHY NOT NULL, col3_9 BIT(24) NOT NULL, col3_10 UUID NULL, col3_11 REGCLASS NULL, PRIMARY KEY (col3_5), INVERTED INDEX (col3_6, col3_5 DESC, col3_11, col3_4 ASC), FAMILY (col3_5, col3_4), FAMILY (col3_0, col3_10, col3_8), FAMILY (col3_7, col3_9, col3_11), FAMILY (col3_6, col3_1, col3_2, col3_3));
        CREATE TABLE table4 (col1_1 REGNAMESPACE NOT NULL, col4_1 INT2 NOT NULL, col4_2 UUID, col4_3 REGPROC NULL, col4_4 STRING NULL, col4_5 REGNAMESPACE, col4_6 "char" NOT NULL, col4_7 VARCHAR, col4_8 REGTYPE, col4_9 FLOAT8 NOT NULL, col4_10 BOX2D NOT NULL, col4_11 REGCLASS NULL, col4_12 OID NULL, col4_13 INT4, PRIMARY KEY (col1_1 DESC), UNIQUE (col4_11 ASC, col4_2 ASC, col4_7, col4_5 DESC, col4_8 ASC) STORING (col4_4, col4_12, col4_13) WHERE (table4.col4_6 = '"':::STRING) OR (table4.col4_4 >= 'X':::STRING), FAMILY (col4_3), FAMILY (col4_12, col4_2, col4_13), FAMILY (col4_5, col4_7), FAMILY (col4_11), FAMILY (col4_9, col4_8), FAMILY (col4_4, col4_6), FAMILY (col1_1), FAMILY (col4_10), FAMILY (col4_1), UNIQUE (col1_1, col4_3, col4_1)) INTERLEAVE IN PARENT table1 (col1_1);
        CREATE TABLE table5 (col1_1 REGNAMESPACE NOT NULL, col5_1 "char" NULL, col5_2 CHAR NULL, col5_3 TIMESTAMPTZ, PRIMARY KEY (col1_1 DESC, col5_1 ASC, col5_2), INDEX (col5_3 ASC, col5_2 DESC, col5_1 ASC, col1_1 ASC) WHERE ((table5.col5_1 < e'\x00':::STRING) OR (table5.col5_2 != e'\U00002603':::STRING)) AND (table5.col5_3 <= '-4713-11-24 00:00:00+00:00':::TIMESTAMPTZ), INDEX (col5_1) WHERE ((table5.col5_1 < '"':::STRING) AND (table5.col5_3 >= '-2000-01-01 00:00:00+00:00':::TIMESTAMPTZ)) OR (table5.col5_2 > e'\U00002603':::STRING), UNIQUE (col5_1, col1_1 DESC), INDEX (col1_1 ASC) STORING (col5_3) WHERE ((table5.col5_3 != '0001-01-01 00:00:00+00:00':::TIMESTAMPTZ) AND (table5.col5_1 = e'\'':::STRING)) OR (table5.col5_2 < e'\x00':::STRING), INDEX (col5_1 ASC, col1_1), FAMILY (col1_1, col5_2, col5_3, col5_1)) INTERLEAVE IN PARENT table1 (col1_1);
        ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 46890, "histo_buckets": [{"distinct_range": 0, "num_eq": 2000000, "num_range": 0, "upper_bound": "\\\\x"}, {"distinct_range": 2774152811169187300, "num_eq": 30000, "num_range": 2774152811169187276, "upper_bound": "\\\\x566c881082f9"}, {"distinct_range": 60, "num_eq": 1000000, "num_range": 60, "upper_bound": "\\\\x6e20f4be639a46"}, {"distinct_range": 9000000000, "num_eq": 200, "num_range": 9000000000, "upper_bound": "\\\\x7467d9ab86eb"}, {"distinct_range": 0, "num_eq": 216472505893788713, "num_range": 0, "upper_bound": "\\\\xa57b"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 0, "row_count": 90000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6863, "histo_buckets": [{"distinct_range": 0, "num_eq": 6458184319848371582, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 416326150287337300, "num_eq": 40000, "num_range": 3065647719965622785, "upper_bound": "222021798"}, {"distinct_range": 0, "num_eq": 100000, "num_range": 0, "upper_bound": "2750252917"}, {"distinct_range": 1000000000, "num_eq": 4000000000, "num_range": 1000000000, "upper_bound": "3812493977"}, {"distinct_range": 0, "num_eq": 300, "num_range": 0, "upper_bound": "3935404960"}, {"distinct_range": 0, "num_eq": 7022358113232293863, "num_range": 2000, "upper_bound": "4094879144"}], "histo_col_type": "REGNAMESPACE", "name": "__auto__", "null_count": 0, "row_count": 90000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6537, "histo_col_type": "", "name": "__auto__", "null_count": 1895, "row_count": 8000}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2724, "histo_col_type": "", "name": "__auto__", "null_count": 1145, "row_count": 8000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 385, "histo_buckets": [{"distinct_range": 0, "num_eq": 5055047769701022980, "num_range": 0, "upper_bound": "852871787"}, {"distinct_range": 3039844953767575600, "num_eq": 30000000, "num_range": 3039844953767575489, "upper_bound": "2332581950"}, {"distinct_range": 0, "num_eq": 1280902220435360339, "num_range": 10000000000, "upper_bound": "2698235267"}, {"distinct_range": 0, "num_eq": 4690193427265567698, "num_range": 5827318451645186903, "upper_bound": "3016680335"}, {"distinct_range": 10000000000, "num_eq": 8367296368574685526, "num_range": 10000000000, "upper_bound": "3030547741"}, {"distinct_range": 0, "num_eq": 1555397433782292638, "num_range": 0, "upper_bound": "3087409988"}, {"distinct_range": 50, "num_eq": 7309103104141454157, "num_range": 50, "upper_bound": "3418461130"}, {"distinct_range": 4643768436843623000, "num_eq": 3683840622797270337, "num_range": 7083222538832212680, "upper_bound": "3780433893"}], "histo_col_type": "REGNAMESPACE", "name": "__auto__", "null_count": 0, "row_count": 8000}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7298, "histo_col_type": "", "name": "__auto__", "null_count": 989, "row_count": 8000}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4632, "histo_col_type": "", "name": "__auto__", "null_count": 5698, "row_count": 8000}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS '[{"columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3457, "histo_col_type": "", "name": "__auto__", "null_count": 37457, "row_count": 50000}, {"columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 32104, "histo_buckets": [{"distinct_range": 0, "num_eq": 7000000000, "num_range": 0, "upper_bound": "-26756"}, {"distinct_range": 0, "num_eq": 900000, "num_range": 5221345860873310404, "upper_bound": "-15910"}, {"distinct_range": 5784077375356953000, "num_eq": 8218576107538229486, "num_range": 7088186244690534291, "upper_bound": "1860"}, {"distinct_range": 248879.1443206945, "num_eq": 100, "num_range": 800000, "upper_bound": "29609"}], "histo_col_type": "INT2", "name": "__auto__", "null_count": 0, "row_count": 50000}, {"columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 12873, "histo_col_type": "", "name": "__auto__", "null_count": 27822, "row_count": 50000}, {"columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8058, "histo_col_type": "", "name": "__auto__", "null_count": 3898, "row_count": 50000}, {"columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 40839, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000}, {"columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 48691, "histo_col_type": "", "name": "__auto__", "null_count": 39434, "row_count": 50000}, {"columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6689, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000}, {"columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 14743, "histo_col_type": "", "name": "__auto__", "null_count": 14781, "row_count": 50000}, {"columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 17466, "histo_col_type": "", "name": "__auto__", "null_count": 31028, "row_count": 50000}, {"columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3126, "histo_col_type": "", "name": "__auto__", "null_count": 17586, "row_count": 50000}, {"columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 11653, "histo_col_type": "", "name": "__auto__", "null_count": 29465, "row_count": 50000}, {"columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 9264, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000}]':::JSONB;
        ALTER TABLE table4 INJECT STATISTICS '[{"columns": ["col4_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 22310, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000}, {"columns": ["col4_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 29776, "histo_col_type": "", "name": "__auto__", "null_count": 28132, "row_count": 50000}, {"columns": ["col4_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8070, "histo_col_type": "", "name": "__auto__", "null_count": 33618, "row_count": 50000}, {"columns": ["col4_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1807, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000}, {"columns": ["col4_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 30117, "histo_col_type": "", "name": "__auto__", "null_count": 32912, "row_count": 50000}, {"columns": ["col4_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 45007, "histo_col_type": "", "name": "__auto__", "null_count": 16107, "row_count": 50000}, {"columns": ["col4_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 48885, "histo_col_type": "", "name": "__auto__", "null_count": 25051, "row_count": 50000}, {"columns": ["col4_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 20776, "histo_col_type": "", "name": "__auto__", "null_count": 18267, "row_count": 50000}, {"columns": ["col4_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 28068, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000}, {"columns": ["col4_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 33482, "histo_col_type": "", "name": "__auto__", "null_count": 42317, "row_count": 50000}, {"columns": ["col4_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 27744, "histo_buckets": [{"distinct_range": 0, "num_eq": 1123102549852626389, "num_range": 0, "upper_bound": "1267685408"}, {"distinct_range": 3645738009149221400, "num_eq": 8761520740290008466, "num_range": 5207803636121324949, "upper_bound": "2099384792"}, {"distinct_range": 5134631234368856000, "num_eq": 80000, "num_range": 5895797281719084369, "upper_bound": "2966848244"}], "histo_col_type": "REGCLASS", "name": "__auto__", "null_count": 6218, "row_count": 50000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 34206, "histo_buckets": [{"distinct_range": 0, "num_eq": 5123873885581156943, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 30000000000, "num_eq": 4546066970716144447, "num_range": 30000000000, "upper_bound": "300665527"}, {"distinct_range": 0, "num_eq": 5000000000, "num_range": 3912059379840608062, "upper_bound": "731100197"}, {"distinct_range": 0, "num_eq": 8000000000, "num_range": 6164262354431248774, "upper_bound": "1071850087"}, {"distinct_range": 5629017448089651000, "num_eq": 586957991170200327, "num_range": 5629017448089650828, "upper_bound": "1265601205"}, {"distinct_range": 5871315924483351000, "num_eq": 2282311447227993715, "num_range": 5871315924483350332, "upper_bound": "2292438113"}, {"distinct_range": 425006275905241900, "num_eq": 3000000, "num_range": 3479688042591609525, "upper_bound": "2882773065"}, {"distinct_range": 0, "num_eq": 8579673529286480669, "num_range": 200000, "upper_bound": "3203737566"}], "histo_col_type": "REGNAMESPACE", "name": "__auto__", "null_count": 0, "row_count": 50000}, {"columns": ["col4_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 9736, "histo_col_type": "", "name": "__auto__", "null_count": 21008, "row_count": 50000}, {"columns": ["col4_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 40568, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000}]':::JSONB;
        ALTER TABLE table5 INJECT STATISTICS e'[{"columns": ["col5_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 30, "histo_col_type": "TIMESTAMPTZ", "name": "__auto__", "null_count": 408, "row_count": 800}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 524, "histo_buckets": [{"distinct_range": 0, "num_eq": 4300560041049261588, "num_range": 0, "upper_bound": "2879246348"}], "histo_col_type": "REGNAMESPACE", "name": "__auto__", "null_count": 0, "row_count": 800}, {"columns": ["col5_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 174, "histo_buckets": [{"distinct_range": 0, "num_eq": 1818105689024071880, "num_range": 0, "upper_bound": "\\u0000"}, {"distinct_range": 0, "num_eq": 200, "num_range": 80, "upper_bound": "\U00002603"}], "histo_col_type": "\\"char\\"", "name": "__auto__", "null_count": 237, "row_count": 800}, {"columns": ["col5_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 584, "histo_col_type": "", "name": "__auto__", "null_count": 261, "row_count": 800}]':::JSONB;
        ALTER TABLE table3 ADD FOREIGN KEY (col3_11, col3_6, col3_0) REFERENCES table4 (col1_1, col4_3, col4_1);
        ALTER TABLE table2 ADD FOREIGN KEY (col2_2) REFERENCES table1 (col1_1);
        CREATE TYPE rand_typ_0 AS ENUM ('rm', 'phal', 'h');
        CREATE TYPE rand_typ_1 AS ENUM ('bxhlz', 'xfiyq', 'xcanp');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith031886451
--- FAIL: TestRandomSyntaxSQLSmith (301.58s)
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 @rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

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

    rsg_test.go:764: 291595 executions, 270199 successful
    rsg_test.go:575: To reproduce, use schema:
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        		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 "char" NULL, col1_1 NAME NOT NULL, col1_2 FLOAT8, col1_3 FLOAT4 NULL, col1_4 BIT(2)[] NOT NULL, col1_5 INT8 NOT NULL, col1_6 INT8, col1_7 INT4, col1_8 STRING NULL AS (lower(col1_0)) VIRTUAL, col1_9 STRING NULL AS (lower(col1_0)) STORED, FAMILY (col1_9), FAMILY (col1_3, col1_6), FAMILY (col1_7), FAMILY (col1_5, col1_2), FAMILY (col1_4, col1_1), FAMILY (col1_0));
        CREATE TABLE table2 (col2_0 TIMESTAMPTZ NULL, col2_1 INT2 NOT NULL, col2_2 BIT(38) NOT NULL, col2_3 BOX2D NOT NULL, col2_4 FLOAT8 NOT NULL, col2_5 OID NOT NULL, col2_6 INT8 NOT NULL, col2_7 REGTYPE NOT NULL, col2_8 BIT(2) NOT NULL, col2_9 FLOAT4, col2_10 TIMESTAMPTZ NOT NULL, PRIMARY KEY (col2_3, col2_5 ASC, col2_4, col2_8, col2_2), col2_11 STRING NOT NULL AS (CASE WHEN col2_10 IS NULL THEN 'S_':::STRING ELSE 'y,Kn[':::STRING END) VIRTUAL, col2_12 STRING NOT NULL AS (CASE WHEN col2_10 IS NULL THEN e'\x1b':::STRING ELSE e'-\x12R':::STRING END) STORED, col2_13 INT2 NOT NULL AS (col2_1 + col2_6) STORED, col2_14 FLOAT8 NOT NULL AS (col2_4 + 0.8409424520727797:::FLOAT8) STORED, col2_15 FLOAT8 AS (col2_4 + col2_9) STORED, col2_16 FLOAT8 NOT NULL AS (col2_4 + (-1.110970211514561):::FLOAT8) STORED, col2_17 INT8 AS (col2_6 + col2_1) VIRTUAL, INDEX (col2_16 DESC, col2_15 DESC, col2_6, col2_4, col2_8, col2_9 ASC) STORING (col2_0, col2_1, col2_7, col2_10, col2_12, col2_13), INDEX (col2_7 DESC, col2_17 DESC, col2_5 ASC, col2_8, col2_6 ASC, col2_10, col2_12 ASC) STORING (col2_0, col2_1, col2_14), UNIQUE (col2_6 DESC, col2_13 ASC, col2_11 ASC, col2_9 ASC, col2_5, col2_2 DESC, col2_10, col2_16, col2_3 ASC, col2_14 ASC, col2_1 ASC, col2_12) STORING (col2_0, col2_15) WHERE ((((((((((((table2.col2_16 > '+Inf':::FLOAT8) OR (table2.col2_12 <= e'\'':::STRING)) OR (table2.col2_4 <= '-Inf':::FLOAT8)) AND (table2.col2_10 > '0001-01-01 00:00:00+00:00':::TIMESTAMPTZ)) OR (table2.col2_1 <= 1:::INT8)) AND (table2.col2_17 <= 32767:::INT8)) OR (table2.col2_9 >= 1.0:::FLOAT8)) OR (table2.col2_15 > 1.401298464324817e-45:::FLOAT8)) AND (table2.col2_11 >= e'\'':::STRING)) OR (table2.col2_14 != 5e-324:::FLOAT8)) AND (table2.col2_0 = '-2000-01-01 00:00:00+00:00':::TIMESTAMPTZ)) AND (table2.col2_13 = (-128):::INT8)) AND (table2.col2_6 = (-2147483648):::INT8), UNIQUE (col2_11 DESC, col2_6 DESC, col2_8, col2_12 DESC) STORING (col2_0, col2_7, col2_9, col2_10, col2_13, col2_15) WHERE ((((((((table2.col2_14 = 0.0:::FLOAT8) AND (table2.col2_9 >= 0.0:::FLOAT8)) OR (table2.col2_10 != '0001-01-01 00:00:00+00:00':::TIMESTAMPTZ)) AND (table2.col2_12 <= e'\U00002603':::STRING)) OR (table2.col2_6 >= (-2147483648):::INT8)) OR (table2.col2_0 < '-4713-11-24 00:00:00+00:00':::TIMESTAMPTZ)) AND (table2.col2_1 > 0:::INT8)) AND (table2.col2_16 != 0.0:::FLOAT8)) AND (table2.col2_17 >= (-9223372036854775807):::INT8), FAMILY (col2_1), FAMILY (col2_14), FAMILY (col2_2), FAMILY (col2_13, col2_10), FAMILY (col2_6, col2_4, col2_8, col2_15), FAMILY (col2_12, col2_9, col2_5), FAMILY (col2_16, col2_7), FAMILY (col2_0, col2_3));
        ALTER TABLE table1 INJECT STATISTICS '[{"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3664, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 7506, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 43376, "histo_col_type": "", "name": "__auto__", "null_count": 11891, "row_count": 50000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 37921, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 50000}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 13649, "histo_col_type": "", "name": "__auto__", "null_count": 30464, "row_count": 50000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 19076, "histo_col_type": "", "name": "__auto__", "null_count": 10182, "row_count": 50000}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 46029, "histo_col_type": "", "name": "__auto__", "null_count": 45560, "row_count": 50000}, {"columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 46593, "histo_col_type": "", "name": "__auto__", "null_count": 21486, "row_count": 50000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 508, "histo_col_type": "", "name": "__auto__", "null_count": 17448, "row_count": 50000}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 47263, "histo_col_type": "", "name": "__auto__", "null_count": 44241, "row_count": 50000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 602855325087683868, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 457357488314435445, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 918577860620179869, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1725706371706590796, "histo_buckets": [{"distinct_range": 0, "num_eq": 8097474496963047183, "num_range": 0, "upper_bound": "363549961002482194"}], "histo_col_type": "INT8", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3076792474069400032, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_16"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3157599063612088020, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 965369023169622927, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 861225722861262085, "histo_col_type": "", "name": "__auto__", "null_count": 1083050937082329969, "row_count": 4270823175829204498}, {"columns": ["col2_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 449626467124271670, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3372427768578083570, "histo_col_type": "", "name": "__auto__", "null_count": 51858279357611363, "row_count": 4270823175829204498}, {"columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2388100314388346289, "histo_col_type": "", "name": "__auto__", "null_count": 2309073525401867831, "row_count": 4270823175829204498}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3667321473253211737, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2359728252265806975, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 711481065660560061, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1407922772232638974, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 416289027656128858, "histo_buckets": [{"distinct_range": 0, "num_eq": 4713951637880218426, "num_range": 0, "upper_bound": "]``O"}], "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2199417384255265003, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 4270823175829204498}, {"columns": ["col2_17"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1189917948841067794, "histo_col_type": "", "name": "__auto__", "null_count": 1473743744842237875, "row_count": 4270823175829204498}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('z', 'lw', 'usdp');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith341742438
--- FAIL: TestRandomSyntaxSQLSmith (300.55s)
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 @rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

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

    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        		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 NAME NOT NULL, col1_1 DATE NOT NULL, PRIMARY KEY (col1_0 ASC, col1_1 DESC), INDEX (col1_0 DESC) WHERE (table1.col1_0 != e'\U00002603':::STRING) AND (table1.col1_1 < 'infinity':::DATE), UNIQUE (col1_0, col1_1 DESC) WHERE table1.col1_1 < '-infinity':::DATE, UNIQUE (col1_1 ASC, col1_0 ASC), UNIQUE (col1_1 ASC) WHERE table1.col1_0 > '"':::STRING, INDEX (col1_1 DESC, col1_0), INDEX (col1_0, col1_1 ASC) WHERE table1.col1_1 < '4714-11-24 BC':::DATE);
        CREATE TABLE table2 (col1_0 NAME NOT NULL, col1_1 DATE NOT NULL, col2_2 BYTES NULL, col2_3 INT8 NULL, col2_4 REGNAMESPACE NOT NULL, col2_5 TIMESTAMP, col2_6 DECIMAL NULL, col2_7 TIME, col2_8 REGPROC, col2_9 REGTYPE NULL, PRIMARY KEY (col1_0 ASC, col1_1 DESC, col2_5, col2_7 DESC, col2_8, col2_9 DESC, col2_3), UNIQUE (col2_5 DESC, col2_9, col1_0, col2_7 DESC, col2_2, col2_8 DESC, col2_6 ASC, col2_3 ASC, col1_1, col2_4 ASC) WHERE (((((table2.col2_2 <= '\xff':::BYTES) AND (table2.col1_0 = e'\'':::STRING)) OR (table2.col2_5 <= '3000-01-01 00:00:00':::TIMESTAMP)) AND (table2.col1_1 != '5874897-12-31':::DATE)) AND (table2.col2_7 < '00:00:00':::TIME)) AND (table2.col2_3 >= 127:::INT8), UNIQUE (col2_6, col1_0 ASC, col1_1, col2_7 DESC, col2_3 DESC), UNIQUE (col2_9 DESC, col2_3 ASC, col2_6 DESC, col1_1 ASC), INDEX (col2_5 DESC, col1_1 DESC, col2_7 DESC) STORING (col2_2, col2_4, col2_6) WHERE ((((((table2.col1_0 <= '':::STRING) AND (table2.col1_1 <= '1970-01-01':::DATE)) AND (table2.col2_3 >= (-128):::INT8)) OR (table2.col2_2 != '\xff':::BYTES)) OR (table2.col2_5 != '-4713-11-24 00:00:00':::TIMESTAMP)) AND (table2.col2_6 > (-1):::DECIMAL)) OR (table2.col2_7 >= '24:00:00':::TIME), UNIQUE (col2_5 DESC, col2_9 ASC), INDEX (col2_6 ASC, col2_4 ASC) STORING (col2_2) WHERE ((table2.col2_3 < (-1):::INT8) OR (table2.col1_0 < '"':::STRING)) AND (table2.col2_2 != '\xff':::BYTES), INDEX (col2_2 ASC, col2_9 DESC, col2_3 DESC, col2_5 DESC, col2_6 DESC, col2_8 DESC, col1_1 DESC) STORING (col2_4) WHERE ((((table2.col2_7 != '24:00:00':::TIME) OR (table2.col2_5 != '-2000-01-01 00:00:00':::TIMESTAMP)) OR (table2.col2_6 > '-Infinity':::DECIMAL)) OR (table2.col1_1 = 'infinity':::DATE)) AND (table2.col2_2 >= '\x58':::BYTES), UNIQUE (col2_3, col2_8 DESC, col2_2 DESC, col2_7 ASC, col2_9 ASC, col1_1 DESC) WHERE ((((((table2.col2_6 < '-Infinity':::DECIMAL) AND (table2.col2_7 < '24:00:00':::TIME)) OR (table2.col2_2 != '\x58':::BYTES)) OR (table2.col1_1 < 'infinity':::DATE)) AND (table2.col2_3 >= 1:::INT8)) AND (table2.col1_0 <= '"':::STRING)) OR (table2.col2_5 < '-4713-11-24 00:00:00':::TIMESTAMP), UNIQUE (col2_9, col2_3 ASC, col2_8, col2_2, col2_4 ASC, col2_5, col2_6 DESC, col2_7 DESC, col1_1, col1_0 ASC)) INTERLEAVE IN PARENT table1 (col1_0, col1_1);
        CREATE TABLE table3 (col3_0 REGPROC NULL, col3_1 UUID NOT NULL, col3_2 INT2[] NOT NULL, col3_3 BIT(12) NOT NULL, col3_4 "char" NULL, col3_5 DATE, col3_6 CHAR NULL, col3_7 UUID NULL, col3_8 "char"[] NULL, col3_9 TIMESTAMPTZ NOT NULL, col3_10 INET NULL, PRIMARY KEY (col3_1, col3_9), col3_11 STRING NOT NULL AS (CASE WHEN col3_9 IS NULL THEN 'Z>':::STRING ELSE e'p\x18,l\x7fj>j':::STRING END) VIRTUAL, col3_12 STRING NULL AS (lower(CAST(col3_7 AS STRING))) VIRTUAL, col3_13 STRING NOT NULL AS (lower(CAST(col3_3 AS STRING))) VIRTUAL);
        ALTER TABLE table1 INJECT STATISTICS '[{"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2591629412542808086, "histo_buckets": [{"distinct_range": 0, "num_eq": 7984511247381418838, "num_range": 0, "upper_bound": ""}, {"distinct_range": 6579991276695883000, "num_eq": 1719292909167535042, "num_range": 6579991276695883182, "upper_bound": "1"}], "histo_col_type": "NAME", "name": "__auto__", "null_count": 0, "row_count": 4066942560342616606}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1141702529887240849, "histo_buckets": [{"distinct_range": 0, "num_eq": 80000000000, "num_range": 0, "upper_bound": "infinity"}], "histo_col_type": "DATE", "name": "__auto__", "null_count": 0, "row_count": 4066942560342616606}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS e'[{"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 195, "histo_col_type": "", "name": "__auto__", "null_count": 449, "row_count": 500}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 245, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 449, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 187, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 381, "histo_buckets": [{"distinct_range": 0, "num_eq": 4000, "num_range": 0, "upper_bound": "-2000-01-01 00:00:00"}, {"distinct_range": 271223.8936970905, "num_eq": 4338538778078841898, "num_range": 800000, "upper_bound": "1972-07-19 13:22:13.000659"}, {"distinct_range": 0, "num_eq": 309623317147143279, "num_range": 4000000, "upper_bound": "1997-08-17 11:40:39.000068"}, {"distinct_range": 0, "num_eq": 500000000, "num_range": 10000, "upper_bound": "2001-03-08 22:55:57.000852"}, {"distinct_range": 9175658629.63341, "num_eq": 1135242255333494349, "num_range": 70000000000, "upper_bound": "2009-01-17 09:27:47.000711"}], "histo_col_type": "TIMESTAMP", "name": "__auto__", "null_count": 92, "row_count": 500}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 260, "histo_buckets": [{"distinct_range": 0, "num_eq": 6923077617148893766, "num_range": 0, "upper_bound": "2924293963"}, {"distinct_range": 0, "num_eq": 6840445224925307154, "num_range": 325837082819423970, "upper_bound": "3124256091"}, {"distinct_range": 1586495927393651000, "num_eq": 4227314844861724342, "num_range": 1586495927393650896, "upper_bound": "3737846627"}, {"distinct_range": 6497054737004304000, "num_eq": 60000000000, "num_range": 6497054737004303954, "upper_bound": "3944625983"}], "histo_col_type": "REGTYPE", "name": "__auto__", "null_count": 302, "row_count": 500}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 412, "histo_buckets": [{"distinct_range": 0, "num_eq": 6000000000, "num_range": 0, "upper_bound": "\\\\x"}, {"distinct_range": 0, "num_eq": 2923280442965351627, "num_range": 0, "upper_bound": "\\\\x3b020f0f7d47"}, {"distinct_range": 1516505456839363000, "num_eq": 5993025256862638067, "num_range": 1734438455568782327, "upper_bound": "\\\\x74"}, {"distinct_range": 8000000, "num_eq": 1000000000, "num_range": 8000000, "upper_bound": "\\\\xa66bafee36b23b1b"}, {"distinct_range": 0, "num_eq": 3665312652002182436, "num_range": 6045554493418279943, "upper_bound": "\\\\xa9"}, {"distinct_range": 355496.2693070351, "num_eq": 10000000, "num_range": 400000, "upper_bound": "\\\\xcab536a008395b6b83"}, {"distinct_range": 10000, "num_eq": 90000000, "num_range": 10000, "upper_bound": "\\\\xd52f4959ac61"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 418, "row_count": 500}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 434, "histo_col_type": "", "name": "__auto__", "null_count": 405, "row_count": 500}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 26, "histo_buckets": [{"distinct_range": 0, "num_eq": 30000, "num_range": 0, "upper_bound": "3000942381.594792688"}, {"distinct_range": 0, "num_eq": 5490137469482790284, "num_range": 9000000000, "upper_bound": "6.212547100890043043E+37"}], "histo_col_type": "DECIMAL", "name": "__auto__", "null_count": 427, "row_count": 500}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 437, "histo_col_type": "", "name": "__auto__", "null_count": 401, "row_count": 500}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS '[{"columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 233584934726008078, "histo_col_type": "", "name": "__auto__", "null_count": 1541024499625202748, "row_count": 2082601315997324849}, {"columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 478145557575751908, "histo_col_type": "", "name": "__auto__", "null_count": 560198880927572810, "row_count": 2082601315997324849}, {"columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 234236865471093827, "histo_col_type": "", "name": "__auto__", "null_count": 878126843710227695, "row_count": 2082601315997324849}, {"columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 638995804386818074, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2082601315997324849}, {"columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1980139060362306456, "histo_col_type": "", "name": "__auto__", "null_count": 938272122815437521, "row_count": 2082601315997324849}, {"columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1254798105647793323, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2082601315997324849}, {"columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1981694285514664116, "histo_col_type": "", "name": "__auto__", "null_count": 2067786189744593159, "row_count": 2082601315997324849}, {"columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 428603175099171969, "histo_col_type": "", "name": "__auto__", "null_count": 72561512057843845, "row_count": 2082601315997324849}, {"columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1614744272553010400, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2082601315997324849}, {"columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1234724781883676577, "histo_col_type": "", "name": "__auto__", "null_count": 165406156729763120, "row_count": 2082601315997324849}, {"columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 157838962245658911, "histo_buckets": [{"distinct_range": 0, "num_eq": 3344675195557821707, "num_range": 0, "upper_bound": "18b4b019-5f97-40d8-a996-22303c1e8c70"}, {"distinct_range": 3789063823097827000, "num_eq": 0, "num_range": 3789063823097826711, "upper_bound": "222d895b-650e-4acf-bfde-390bc5336ef4"}, {"distinct_range": 600.5117506131024, "num_eq": 400000000, "num_range": 800, "upper_bound": "3ca1db90-45cc-46f4-bd06-5ba1f09f50d7"}, {"distinct_range": 0, "num_eq": 70000000, "num_range": 9047937243226367638, "upper_bound": "5fa69777-f222-46e7-9369-c39400b939d4"}, {"distinct_range": 40000000, "num_eq": 686159179526344021, "num_range": 40000000, "upper_bound": "b5d7b7fc-6c68-41f5-ba4b-a00acba4bf4e"}, {"distinct_range": 40000000000, "num_eq": 8981506710182292433, "num_range": 40000000000, "upper_bound": "e9854afe-c50c-4e82-87a5-2ed7402d6c12"}, {"distinct_range": 0, "num_eq": 9000000, "num_range": 0, "upper_bound": "f1339e1c-73fc-4a83-b774-df2f14691c2c"}, {"distinct_range": 0, "num_eq": 887813060308958029, "num_range": 1013921699154489941, "upper_bound": "fdd1c073-298f-453e-bed2-0f00c5881313"}], "histo_col_type": "UUID", "name": "__auto__", "null_count": 0, "row_count": 2082601315997324849}, {"columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 783456881517890183, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2082601315997324849}, {"columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1627900248032584335, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 2082601315997324849}, {"columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1084668032967851859, "histo_col_type": "", "name": "__auto__", "null_count": 15024430063804051, "row_count": 2082601315997324849}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('jvpq', 'c', 'iv', 'a', 'otvz');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith066385117
--- FAIL: TestRandomSyntaxSQLSmith (300.59s)
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 @rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

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

        CREATE TABLE table4 (col4_0 OID, col4_1 BYTES NOT NULL, PRIMARY KEY (col4_1), col4_2 STRING AS (lower(CAST(col4_0 AS STRING))) STORED, INDEX (col4_0, col4_2 ASC), UNIQUE (col4_1 ASC), UNIQUE (col4_1 DESC) WHERE (table4.col4_2 < e'\'':::STRING) AND (table4.col4_1 > '\x22':::BYTES), UNIQUE (col4_1 DESC, col4_0 DESC, col4_2), INDEX (col4_1 ASC, col4_0 DESC, col4_2 ASC), INDEX (col4_0 ASC, col4_1 DESC), INDEX (col4_1 DESC, col4_2 ASC), INDEX (col4_0 ASC, col4_1 DESC) WHERE table4.col4_2 != e'\U00002603':::STRING);
        CREATE TABLE table5 (col2_6 OID NOT NULL, col2_5 OID NOT NULL, col2_7 OID NOT NULL, col5_3 REGNAMESPACE NOT NULL, col5_4 BIT NULL, col5_5 TIMETZ NOT NULL, col5_6 DATE, col5_7 CHAR, col5_8 STRING NULL, col5_9 UUID NOT NULL, col5_10 NAME, col5_11 REGPROCEDURE, col5_12 BIT(25) NULL, col5_13 BYTES NULL, col5_14 BYTES, col5_15 BOOL NOT NULL, PRIMARY KEY (col2_6, col2_5, col2_7, col5_9 ASC, col5_14 DESC, col5_13 DESC, col5_3 ASC, col5_12 ASC, col5_6 ASC, col5_11 DESC, col5_4 DESC, col5_15 DESC, col5_5, col5_7, col5_10), INDEX (col2_6 ASC, col2_5 ASC, col5_9 DESC, col5_8, col5_6, col5_15, col5_14 ASC, col2_7 DESC, col5_12, col5_4 DESC), UNIQUE (col5_11 ASC, col5_15 DESC), UNIQUE (col5_12, col5_10 DESC, col5_9 DESC, col2_6 ASC, col5_5 DESC, col2_5 DESC, col5_4 ASC, col5_6 DESC, col5_7 ASC, col5_13 ASC, col5_15 DESC, col5_11, col5_14 ASC, col5_3 DESC, col2_7 ASC, col5_8), UNIQUE (col5_12, col5_5 DESC, col5_13 ASC, col2_6 DESC, col2_7, col5_10, col5_8 ASC, col5_15 ASC, col5_3 ASC, col5_11 DESC) WHERE (((((((NOT table5.col5_15) AND (table5.col5_13 < '\x':::BYTES)) OR (table5.col5_14 != '\x27':::BYTES)) OR (table5.col5_7 = 'X':::STRING)) OR (table5.col5_6 < 'infinity':::DATE)) AND (table5.col5_5 <= '00:00:00+15:59:00':::TIMETZ)) AND (table5.col5_10 > e'\'':::STRING)) AND (table5.col5_8 > 'X':::STRING), UNIQUE (col5_12 DESC, col5_9 ASC, col5_7 ASC, col5_15 ASC, col5_5 DESC, col5_8 ASC, col2_6 DESC, col5_13, col5_6 ASC, col5_11 ASC, col5_4) WHERE (((((((table5.col5_10 >= e'\U00002603':::STRING) AND (table5.col5_5 > '24:00:00-15:59:00':::TIMETZ)) OR (table5.col5_13 = '\x':::BYTES)) AND (table5.col5_7 >= '':::STRING)) OR (NOT table5.col5_15)) AND (table5.col5_6 >= '-infinity':::DATE)) AND (table5.col5_8 < e'\x00':::STRING)) OR (table5.col5_14 != '\x':::BYTES), UNIQUE (col2_6 ASC, col2_7 DESC, col5_12, col5_6, col5_11, col5_13, col5_5 DESC, col5_7 DESC, col5_10 DESC, col5_3 ASC, col5_14, col5_8 DESC, col5_15, col2_5 ASC, col5_4 DESC, col5_9 DESC), INDEX (col5_3 ASC, col5_8, col5_5 ASC, col5_12 ASC, col5_11, col5_15 ASC, col2_7, col5_7 ASC, col5_9 ASC, col5_13 DESC, col5_10), INDEX (col5_11, col5_12 DESC, col5_6 ASC, col2_6 DESC, col5_13 ASC, col2_5 ASC, col5_8, col5_3, col2_7 ASC) WHERE (((((table5.col5_14 > '\x22':::BYTES) OR (table5.col5_13 < '\xff':::BYTES)) OR (table5.col5_7 >= e'\x00':::STRING)) OR (table5.col5_6 = '5874897-12-31':::DATE)) AND (table5.col5_10 < e'\U00002603':::STRING)) OR table5.col5_15, INDEX (col5_4 ASC, col2_6 ASC, col5_11, col5_15, col5_14, col5_13, col2_7 ASC, col5_12, col5_7, col5_10 DESC, col5_5, col5_9 DESC), UNIQUE (col5_13, col2_6)) INTERLEAVE IN PARENT table2 (col2_6, col2_5, col2_7);
        ALTER TABLE table1 INJECT STATISTICS '[{"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 6569, "histo_buckets": [{"distinct_range": 0, "num_eq": 7917342039050739452, "num_range": 0, "upper_bound": "-29913"}], "histo_col_type": "INT2", "name": "__auto__", "null_count": 4797, "row_count": 10000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 17236595499, "histo_col_type": "", "name": "__auto__", "null_count": 40257956550, "row_count": 60000000000}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 51339187207, "histo_col_type": "", "name": "__auto__", "null_count": 15636669160, "row_count": 60000000000}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 48541230093, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 60000000000}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 22366241643, "histo_col_type": "", "name": "__auto__", "null_count": 26112116007, "row_count": 60000000000}, {"columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5806607390, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 60000000000}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 35422141999, "histo_col_type": "", "name": "__auto__", "null_count": 57155116232, "row_count": 60000000000}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 15997835512, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 60000000000}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 12654194174, "histo_col_type": "", "name": "__auto__", "null_count": 26190759300, "row_count": 60000000000}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 17088737537, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 60000000000}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 10372471274, "histo_buckets": [{"distinct_range": 0, "num_eq": 6636562312382461304, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 6963507198419848000, "num_eq": 0, "num_range": 6963507198419848306, "upper_bound": "360141214"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 0, "row_count": 60000000000}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 8480716032, "histo_col_type": "", "name": "__auto__", "null_count": 9553436254, "row_count": 60000000000}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS e'[{"columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 193207664609175308, "histo_buckets": [{"distinct_range": 0, "num_eq": 739849356303969481, "num_range": 0, "upper_bound": "\\\\x"}, {"distinct_range": 1593666156118382600, "num_eq": 7355613040285370136, "num_range": 1593666156118382516, "upper_bound": "\\\\x091225"}, {"distinct_range": 400, "num_eq": 6110454898756202108, "num_range": 400, "upper_bound": "\\\\x1f28"}, {"distinct_range": 6805876910899111000, "num_eq": 5061584849154996199, "num_range": 6805876910899111347, "upper_bound": "\\\\x22"}, {"distinct_range": 0, "num_eq": 20000000000, "num_range": 4172520137058739528, "upper_bound": "\\\\x362d324f"}, {"distinct_range": 5933413081989120000, "num_eq": 7021839371569025258, "num_range": 5933413081989119644, "upper_bound": "\\\\x629b3343955e8c9b"}, {"distinct_range": 7000000, "num_eq": 100000, "num_range": 7000000, "upper_bound": "\\\\xa0"}, {"distinct_range": 3704081278239259000, "num_eq": 2134242626878408932, "num_range": 5917029786616887384, "upper_bound": "\\\\xe7b4f016fb7c228711"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 0, "row_count": 285797660077481468}, {"columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 112618765294363854, "histo_col_type": "", "name": "__auto__", "null_count": 128062374310780000, "row_count": 285797660077481468}]':::JSONB;
        ALTER TABLE table4 INJECT STATISTICS e'[{"columns": ["col4_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4985252317916727047, "histo_buckets": [{"distinct_range": 0, "num_eq": 9142591494251159889, "num_range": 0, "upper_bound": "\\\\xb0e0aa3824be"}, {"distinct_range": 8869317491536589000, "num_eq": 2601130092464544351, "num_range": 8869317491536588827, "upper_bound": "\\\\xdf"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 0, "row_count": 5666250684389361680}, {"columns": ["col4_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4641736343209239008, "histo_col_type": "", "name": "__auto__", "null_count": 4399649088365347416, "row_count": 5666250684389361680}, {"columns": ["col4_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2313251871036899555, "histo_buckets": [{"distinct_range": 0, "num_eq": 40000000000, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 348.8733315583363, "num_eq": 4000000000, "num_range": 500, "upper_bound": "409302168"}, {"distinct_range": 0, "num_eq": 3000000, "num_range": 7000000000, "upper_bound": "1160587126"}, {"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "1408377337"}, {"distinct_range": 6362640668143939000, "num_eq": 90000, "num_range": 8049669891434332270, "upper_bound": "3839673694"}, {"distinct_range": 0, "num_eq": 20000000, "num_range": 400000000, "upper_bound": "3962485920"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 1212456080452061891, "row_count": 5666250684389361680}]':::JSONB;
        ALTER TABLE table5 INJECT STATISTICS '[{"columns": ["col5_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 186017, "histo_col_type": "", "name": "__auto__", "null_count": 507945, "row_count": 800000}, {"columns": ["col5_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 620016, "histo_buckets": [{"distinct_range": 0, "num_eq": 0, "num_range": 0, "upper_bound": "16849618"}, {"distinct_range": 0, "num_eq": 8628810747901247613, "num_range": 90000000, "upper_bound": "459840307"}], "histo_col_type": "REGPROCEDURE", "name": "__auto__", "null_count": 518174, "row_count": 800000}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 698443, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 800000}, {"columns": ["col5_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 635978, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 800000}, {"columns": ["col5_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 760897, "histo_buckets": [{"distinct_range": 0, "num_eq": 30000000000, "num_range": 0, "upper_bound": "01101111100100001000011001000011010011011100111111011010011101111101111110100011000100"}, {"distinct_range": 7511.294811149389, "num_eq": 6095067611759363083, "num_range": 9000, "upper_bound": "01111011000010101000000011000110001100011"}, {"distinct_range": 0, "num_eq": 0, "num_range": 500000, "upper_bound": "111011010000011011000101101110100001101100101110011100100101011100010100101100011"}], "histo_col_type": "BIT", "name": "__auto__", "null_count": 669769, "row_count": 800000}, {"columns": ["col5_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 798301, "histo_col_type": "", "name": "__auto__", "null_count": 495499, "row_count": 800000}, {"columns": ["col5_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 43887, "histo_buckets": [{"distinct_range": 0, "num_eq": 344607400880636697, "num_range": 0, "upper_bound": "0010100110111101101100111"}, {"distinct_range": 45.08843311402525, "num_eq": 20000, "num_range": 90, "upper_bound": "0100001110101101101101000"}, {"distinct_range": 6804174.6864212025, "num_eq": 2890579608927308411, "num_range": 500000000, "upper_bound": "0101110110010101101110000"}, {"distinct_range": 200000, "num_eq": 8227402789105686272, "num_range": 200000, "upper_bound": "0110101010111001110000000"}, {"distinct_range": 0, "num_eq": 500000, "num_range": 296225737837912794, "upper_bound": "1011101011001010011101011"}], "histo_col_type": "BIT(25)", "name": "__auto__", "null_count": 775677, "row_count": 800000}, {"columns": ["col5_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 144822, "histo_col_type": "", "name": "__auto__", "null_count": 324092, "row_count": 800000}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 150388, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 800000}, {"columns": ["col5_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 273256, "histo_col_type": "", "name": "__auto__", "null_count": 527468, "row_count": 800000}, {"columns": ["col5_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 215963, "histo_col_type": "", "name": "__auto__", "null_count": 2930, "row_count": 800000}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 240558, "histo_col_type": "OID", "name": "__auto__", "null_count": 0, "row_count": 800000}, {"columns": ["col5_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3947, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 800000}, {"columns": ["col5_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 772675, "histo_col_type": "", "name": "__auto__", "null_count": 331524, "row_count": 800000}, {"columns": ["col5_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 277048, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 800000}, {"columns": ["col5_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 273027, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 800000}]':::JSONB;
        ALTER TABLE table4 ADD FOREIGN KEY (col4_1) REFERENCES table3 (col3_0);
        ALTER TABLE table3 ADD FOREIGN KEY (col3_0, col3_1) REFERENCES table5 (col5_13, col2_6);
        CREATE TYPE rand_typ_0 AS ENUM ('znf', 'hib', 'rexca', 'dkxdfi');
        CREATE TYPE rand_typ_1 AS ENUM ('jafifq', 'kqniyv', 'z', 'huyf', 'rvin', 'n');
        CREATE TYPE rand_typ_2 AS ENUM ('kl', 'szgi');
        CREATE TYPE rand_typ_3 AS ENUM ('i', 'qxbwo', 'azmvbh', 'p', 'j');
        CREATE TYPE rand_typ_4 AS ENUM ('ie', 'aldl', 'hycpt', 'bq');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith675020808
--- FAIL: TestRandomSyntaxSQLSmith (301.79s)
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 @rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

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

        SET enable_drop_enum_value = true;
        
        		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 INT2 NOT NULL, col1_1 VARCHAR[] NOT NULL, col1_2 INTERVAL NOT NULL, col1_3 BYTES NOT NULL, col1_4 STRING NOT NULL AS (CASE WHEN col1_3 IS NULL THEN e'\x06':::STRING ELSE e'k\x12\nkD\\\\\x07':::STRING END) VIRTUAL, col1_5 STRING NOT NULL AS (lower(CAST(col1_2 AS STRING))) VIRTUAL, INDEX (col1_5 DESC), UNIQUE (col1_4 ASC, col1_0 ASC, col1_5 ASC) STORING (col1_2, col1_3) WHERE (((table1.col1_5 > e'\'':::STRING) AND (table1.col1_3 > '\x58':::BYTES)) OR (table1.col1_4 > 'X':::STRING)) AND (table1.col1_0 >= (-1):::INT8), INDEX (col1_3 ASC) STORING (col1_0) WHERE (((table1.col1_4 < 'X':::STRING) AND (table1.col1_0 <= (-1):::INT8)) OR (table1.col1_5 = e'\U00002603':::STRING)) AND (table1.col1_3 = '\x58':::BYTES), INVERTED INDEX (col1_3 DESC, col1_0, col1_5 DESC, col1_2, col1_4, col1_1 DESC));
        CREATE TABLE table2 (col2_0 BOX2D NOT NULL, col2_1 OID NOT NULL, col2_2 BYTES, col2_3 TIME NOT NULL, col2_4 JSONB, col2_5 BIT(18), col2_6 GEOMETRY NULL, col2_7 REGPROC NOT NULL, col2_8 DECIMAL NULL, col2_9 REGTYPE NOT NULL, col2_10 REGNAMESPACE NULL, col2_11 STRING NOT NULL AS (lower(CAST(col2_3 AS STRING))) VIRTUAL, col2_12 STRING NULL AS (lower(CAST(col2_6 AS STRING))) VIRTUAL, INDEX (col2_2, col2_11 DESC, col2_10 DESC, col2_9 ASC, col2_12));
        CREATE TABLE table3 (col3_0 "char", col3_1 UUID, col3_2 BYTES, col3_3 TIME, col3_4 BIT(30) NOT NULL, col3_5 OID NULL, col3_6 INT2, col3_7 GEOGRAPHY NOT NULL, col3_8 BYTES, col3_9 STRING NOT NULL AS (lower(CAST(col3_4 AS STRING))) STORED, col3_10 STRING NULL AS (lower(CAST(col3_5 AS STRING))) VIRTUAL, col3_11 STRING AS (lower(CAST(col3_1 AS STRING))) VIRTUAL, col3_12 STRING AS (CASE WHEN col3_2 IS NULL THEN e'L\x15]8)':::STRING ELSE '':::STRING END) STORED, col3_13 STRING AS (lower(CAST(col3_1 AS STRING))) STORED, INDEX (col3_5 DESC, col3_2 ASC, col3_13 ASC, col3_1 ASC, col3_12 DESC, col3_9 ASC, col3_6, col3_4 DESC, col3_3 DESC, col3_10 ASC, col3_8 ASC, col3_11 DESC) WHERE (((((((table3.col3_0 > e'\'':::STRING) OR (table3.col3_10 > 'X':::STRING)) AND (table3.col3_3 >= '24:00:00':::TIME)) AND (table3.col3_6 > (-32768):::INT8)) AND (table3.col3_11 = e'\x00':::STRING)) AND (table3.col3_13 >= e'\U00002603':::STRING)) OR (table3.col3_2 > '\x':::BYTES)) AND (table3.col3_8 = '\xe29883':::BYTES), INVERTED INDEX (col3_2, col3_6 ASC, col3_5, col3_1, col3_8 ASC, col3_13, col3_0, col3_3 DESC, col3_7 ASC) WHERE (((((((((table3.col3_6 = (-1):::INT8) OR (table3.col3_9 != e'\x00':::STRING)) OR (table3.col3_13 != '':::STRING)) OR (table3.col3_8 > '\xe29883':::BYTES)) AND (table3.col3_2 > '\x':::BYTES)) AND (table3.col3_3 < '00:00:00':::TIME)) AND (table3.col3_10 <= e'\U00002603':::STRING)) OR (table3.col3_11 <= e'\x00':::STRING)) OR (table3.col3_12 != '"':::STRING)) AND (table3.col3_0 <= e'\'':::STRING), UNIQUE (col3_5 DESC, col3_0 ASC, col3_12 ASC));
        ALTER TABLE table1 INJECT STATISTICS e'[{"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1874469752917397339, "histo_buckets": [{"distinct_range": 0, "num_eq": 796082973600643692, "num_range": 0, "upper_bound": "\\\\xa7f31fa58577"}, {"distinct_range": 314584779.89516884, "num_eq": 100000, "num_range": 800000000, "upper_bound": "\\\\xb5831d16828d"}, {"distinct_range": 0, "num_eq": 0, "num_range": 600000000, "upper_bound": "\\\\xc5a17e34dcdad4d7"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 0, "row_count": 5307389965912559665}, {"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2168871349615117720, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5307389965912559665}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1618995186890909047, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5307389965912559665}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 5148652654556953812, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5307389965912559665}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2096356134220736459, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5307389965912559665}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4524347264496060119, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5307389965912559665}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1589517945989820633, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1590258805167679015}, {"columns": ["col2_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 556090820907675667, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1590258805167679015}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 397440647319723186, "histo_col_type": "BYTES", "name": "__auto__", "null_count": 1479200535904397363, "row_count": 1590258805167679015}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1141462476087268375, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1590258805167679015}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 887479865507484835, "histo_col_type": "", "name": "__auto__", "null_count": 408467795092228164, "row_count": 1590258805167679015}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1506870222717534889, "histo_col_type": "", "name": "__auto__", "null_count": 260412885805034692, "row_count": 1590258805167679015}, {"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 889164182090611545, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1590258805167679015}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 209821390755607469, "histo_col_type": "", "name": "__auto__", "null_count": 185249583331711188, "row_count": 1590258805167679015}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1441542334732918033, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1590258805167679015}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1413944009350679148, "histo_col_type": "", "name": "__auto__", "null_count": 1194809568001723275, "row_count": 1590258805167679015}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 820383263051604683, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 1590258805167679015}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 666201030818057345, "histo_col_type": "", "name": "__auto__", "null_count": 1019405948180164904, "row_count": 1590258805167679015}, {"columns": ["col2_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 595890840982045168, "histo_col_type": "", "name": "__auto__", "null_count": 657811945843718448, "row_count": 1590258805167679015}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS e'[{"columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 32572, "histo_col_type": "", "name": "__auto__", "null_count": 311, "row_count": 80000}, {"columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 51419, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 80000}, {"columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 51291, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 80000}, {"columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 53235, "histo_col_type": "", "name": "__auto__", "null_count": 1624, "row_count": 80000}, {"columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 27143, "histo_buckets": [{"distinct_range": 0, "num_eq": 50000000000, "num_range": 0, "upper_bound": "\\\\x1d3c289d8acc7755"}, {"distinct_range": 6000, "num_eq": 7340571374285660734, "num_range": 6000, "upper_bound": "\\\\x36c7ac6fd30dae0d01"}, {"distinct_range": 8256252.276552754, "num_eq": 40, "num_range": 60000000, "upper_bound": "\\\\x84f3"}, {"distinct_range": 5000, "num_eq": 100, "num_range": 5000, "upper_bound": "\\\\xaf4982209974307c2c"}, {"distinct_range": 8000, "num_eq": 5848306102776290534, "num_range": 8000, "upper_bound": "\\\\xf3aedf0aa126d0e486"}], "histo_col_type": "BYTES", "name": "__auto__", "null_count": 19685, "row_count": 80000}, {"columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1707, "histo_col_type": "", "name": "__auto__", "null_count": 31466, "row_count": 80000}, {"columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 21046, "histo_col_type": "", "name": "__auto__", "null_count": 19130, "row_count": 80000}, {"columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 38792, "histo_col_type": "", "name": "__auto__", "null_count": 65185, "row_count": 80000}, {"columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 45630, "histo_col_type": "", "name": "__auto__", "null_count": 40260, "row_count": 80000}, {"columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4514, "histo_col_type": "", "name": "__auto__", "null_count": 62624, "row_count": 80000}, {"columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 66302, "histo_buckets": [{"distinct_range": 0, "num_eq": 4510048995835796926, "num_range": 0, "upper_bound": "1930760300"}, {"distinct_range": 0, "num_eq": 2978361697019187035, "num_range": 3000, "upper_bound": "2094967825"}, {"distinct_range": 606721712.4869993, "num_eq": 6405605827231490306, "num_range": 900000000, "upper_bound": "2817763898"}, {"distinct_range": 5218746327993526000, "num_eq": 5209339820209384060, "num_range": 5218746327993526129, "upper_bound": "3396556796"}, {"distinct_range": 0, "num_eq": 80000, "num_range": 9000000000, "upper_bound": "3561525412"}], "histo_col_type": "OID", "name": "__auto__", "null_count": 55843, "row_count": 80000}, {"columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 52323, "histo_col_type": "", "name": "__auto__", "null_count": 33947, "row_count": 80000}, {"columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 63876, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 80000}, {"columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 48935, "histo_col_type": "", "name": "__auto__", "null_count": 6693, "row_count": 80000}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('z', 'fod', 'qovmty', 'xgxnp');
        CREATE TYPE rand_typ_1 AS ENUM ('hb', 'ce');
        CREATE TYPE rand_typ_2 AS ENUM ('xdyr', 'o', 'm', 'kxro');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith885255157
--- FAIL: TestRandomSyntaxSQLSmith (300.62s)
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 @rafiss

This test on roachdash | Improve this report!

@cockroach-teamcity
Copy link
Member Author

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

    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        		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 BOOL NULL, col1_1 REGTYPE NOT NULL, col1_2 UUID, col1_3 CHAR, col1_4 INET NULL, col1_5 REGTYPE, PRIMARY KEY (col1_1), col1_6 STRING AS (lower(col1_3)) VIRTUAL, UNIQUE (col1_4 ASC, col1_3 DESC, col1_5 ASC, col1_2 DESC) WHERE ((table1.col1_6 < '"':::STRING) AND (NOT table1.col1_0)) AND (table1.col1_3 = '':::STRING), INDEX (col1_3 ASC) STORING (col1_2, col1_4) WHERE ((NOT table1.col1_0) AND (table1.col1_3 >= 'X':::STRING)) OR (table1.col1_6 <= 'X':::STRING), INDEX (col1_5 DESC, col1_0 DESC, col1_6 DESC, col1_1 DESC, col1_3 DESC, col1_4), INDEX (col1_1 DESC, col1_2 ASC));
        ALTER TABLE table1 INJECT STATISTICS '[{"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2349115980424754183, "histo_col_type": "", "name": "__auto__", "null_count": 1917298729806738019, "row_count": 4036772544026817075}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 319646923135524682, "histo_col_type": "", "name": "__auto__", "null_count": 2535221920402524428, "row_count": 4036772544026817075}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 133818837618257742, "histo_col_type": "REGTYPE", "name": "__auto__", "null_count": 0, "row_count": 4036772544026817075}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3562555424817556356, "histo_col_type": "", "name": "__auto__", "null_count": 3641774318275581068, "row_count": 4036772544026817075}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 750364136892913225, "histo_col_type": "", "name": "__auto__", "null_count": 2133291344770336111, "row_count": 4036772544026817075}, {"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 638458836702254300, "histo_buckets": [{"distinct_range": 0, "num_eq": 2916732086676932177, "num_range": 0, "upper_bound": "34.32.30.247/1"}, {"distinct_range": 300000000, "num_eq": 400000, "num_range": 300000000, "upper_bound": "221.95.131.181/6"}, {"distinct_range": 16855.714824953797, "num_eq": 800, "num_range": 50000, "upper_bound": "111.135.163.162/15"}, {"distinct_range": 220040101.97835714, "num_eq": 80000, "num_range": 400000000, "upper_bound": "ac81:36b3:eeb3:aeda:a5a1:f64b:17bf:6928/9"}, {"distinct_range": 30, "num_eq": 7403284141959206125, "num_range": 30, "upper_bound": "cda:2a54:d81:2293:3717:7883:d3fa:55eb/18"}, {"distinct_range": 455312702.81043833, "num_eq": 7512726098881994527, "num_range": 800000000, "upper_bound": "615:6684:5084:746d:85fc:962e:8708:19ae/64"}, {"distinct_range": 0, "num_eq": 0, "num_range": 30000000000, "upper_bound": "4faf:b45d:e8e8:fd0b:d7e1:70e2:3b99:5e6f/85"}, {"distinct_range": 1434.279015456412, "num_eq": 8930776201467843408, "num_range": 5000, "upper_bound": "96ba:a77f:6af5:6da4:a00b:f658:8672:4bf6/118"}], "histo_col_type": "INET", "name": "__auto__", "null_count": 2404925547443349419, "row_count": 4036772544026817075}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2042430777555388399, "histo_col_type": "REGTYPE", "name": "__auto__", "null_count": 898166648113936442, "row_count": 4036772544026817075}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('ahhpv', 'oeea', 'ldsvzl');
        CREATE TYPE rand_typ_1 AS ENUM ('m', 'oj');
        CREATE TYPE rand_typ_2 AS ENUM ('febas', 'ier', 'mkrmz', 'arm', 'ncddzt', 'kdtllb');
        CREATE TYPE rand_typ_3 AS ENUM ('ajo');
        CREATE TYPE rand_typ_4 AS ENUM ('t', 'bdvf', 'kqm', 'mwwhmf');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith819627690
--- FAIL: TestRandomSyntaxSQLSmith (301.51s)
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 @rafiss

This test on roachdash | Improve this report!

@mgartner
Copy link
Collaborator

I've reduced the reproduction to this:

statement ok
CREATE TABLE a (a INT);
CREATE TABLE bc (b INT, c INT AS (b + 1) VIRTUAL, INDEX (b));

statement ok
SELECT a.a
FROM a
    JOIN bc AS bc1
		JOIN bc AS bc2 ON true
	ON a.a = bc1.b AND
	    bc1.b = bc2.b AND
	    bc1.c = bc2.c
	JOIN bc AS bc3 ON
	    bc1.b = bc3.b AND bc2.b = bc3.c

@mgartner
Copy link
Collaborator

The bug was introduced in f5a6fb0

@mgartner
Copy link
Collaborator

The HoistProjectFromInnerJoin exploration rule is part of the issue. The error is not produced when that rule is disabled.

@mgartner
Copy link
Collaborator

Full optsteps output here: https://gist.github.com/mgartner/6597d7fc811960cb6fc1da15ed0996e1

This particular step looks suspicious. Before the rule is applied there is a filter with b:8 = c:13 AND b:8 = b:12. After the rule is applied a b:8 = b:8 % 2 is pushed down because c:13 = b:12 % 2, but there is no longer any filter I see that equates b:8 to b:12 or c:13.

 --------------------------------------------------------------------------------
 HoistProjectFromInnerJoin (higher cost)
 --------------------------------------------------------------------------------
 project
  ├── columns: a:1!null
  ├── immutable
  └── inner-join (hash)
       ├── columns: a:1!null b:4!null c:5!null b:8!null c:9!null b:12!null c:13!null
       ├── immutable
       ├── fd: (4)-->(5), (8)-->(9), (4)==(1,8,12,13), (8)==(1,4,12,13), (5)==(9), (9)==(5), (1)==(4,8,12,13), (12)==(1,4,8,13), (13)==(1,4,8,12)
       ├── project
       │    ├── columns: c:5 b:4
       │    ├── immutable
       │    ├── fd: (4)-->(5)
       │    ├── scan bc
       │    │    ├── columns: b:4
       │    │    └── computed column expressions
       │    │         └── c:5
       │    │              └── b:4 % 2
       │    └── projections
       │         └── b:4 % 2 [as=c:5, outer=(4), immutable]
-      ├── inner-join (hash)
-      │    ├── columns: a:1!null b:8!null c:9 b:12!null c:13!null
+      ├── project
+      │    ├── columns: c:9 a:1!null b:8!null b:12!null c:13!null
       │    ├── immutable
       │    ├── fd: (8)-->(9), (8)==(1,12,13), (12)==(1,8,13), (13)==(1,8,12), (1)==(8,12,13)
       │    ├── inner-join (hash)
-      │    │    ├── columns: b:8!null c:9 b:12!null c:13!null
+      │    │    ├── columns: a:1!null b:8!null b:12!null c:13!null
       │    │    ├── immutable
-      │    │    ├── fd: (8)-->(9), (8)==(12,13), (12)==(8,13), (13)==(8,12)
-      │    │    ├── project
-      │    │    │    ├── columns: c:9 b:8
+      │    │    ├── fd: (12)-->(13), (8)==(1,12), (12)==(1,8), (1)==(8,12)
+      │    │    ├── scan a
+      │    │    │    └── columns: a:1
+      │    │    ├── inner-join (merge)
+      │    │    │    ├── columns: b:8!null b:12!null c:13!null
+      │    │    │    ├── left ordering: +12
+      │    │    │    ├── right ordering: +8
       │    │    │    ├── immutable
-      │    │    │    ├── fd: (8)-->(9)
-      │    │    │    ├── scan bc
+      │    │    │    ├── fd: (12)-->(13), (8)==(12), (12)==(8)
+      │    │    │    ├── project
+      │    │    │    │    ├── columns: c:13!null b:12!null
+      │    │    │    │    ├── immutable
+      │    │    │    │    ├── fd: (12)-->(13)
+      │    │    │    │    ├── ordering: +12
+      │    │    │    │    ├── select
+      │    │    │    │    │    ├── columns: b:12!null
+      │    │    │    │    │    ├── immutable
+      │    │    │    │    │    ├── ordering: +12
+      │    │    │    │    │    ├── scan bc@secondary
+      │    │    │    │    │    │    ├── columns: b:12!null
+      │    │    │    │    │    │    ├── constraint: /12/14: (/NULL - ]
+      │    │    │    │    │    │    └── ordering: +12
+      │    │    │    │    │    └── filters
+      │    │    │    │    │         └── b:12 = (b:12 % 2) [outer=(12), immutable, constraints=(/12: (/NULL - ])]
+      │    │    │    │    └── projections
+      │    │    │    │         └── b:12 % 2 [as=c:13, outer=(12), immutable]
+      │    │    │    ├── scan bc@secondary
       │    │    │    │    ├── columns: b:8
-      │    │    │    │    └── computed column expressions
-      │    │    │    │         └── c:9
-      │    │    │    │              └── b:8 % 2
-      │    │    │    └── projections
-      │    │    │         └── b:8 % 2 [as=c:9, outer=(8), immutable]
-      │    │    ├── project
-      │    │    │    ├── columns: c:13 b:12
-      │    │    │    ├── immutable
-      │    │    │    ├── fd: (12)-->(13)
-      │    │    │    ├── scan bc
-      │    │    │    │    ├── columns: b:12
-      │    │    │    │    └── computed column expressions
-      │    │    │    │         └── c:13
-      │    │    │    │              └── b:12 % 2
-      │    │    │    └── projections
-      │    │    │         └── b:12 % 2 [as=c:13, outer=(12), immutable]
+      │    │    │    │    └── ordering: +8
+      │    │    │    └── filters (true)
       │    │    └── filters
-      │    │         ├── b:8 = c:13 [outer=(8,13), constraints=(/8: (/NULL - ]; /13: (/NULL - ]), fd=(8)==(13), (13)==(8)]
-      │    │         └── b:8 = b:12 [outer=(8,12), constraints=(/8: (/NULL - ]; /12: (/NULL - ]), fd=(8)==(12), (12)==(8)]
-      │    ├── scan a
-      │    │    └── columns: a:1
-      │    └── filters
-      │         └── a:1 = b:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
+      │    │         └── a:1 = b:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
+      │    └── projections
+      │         └── b:8 % 2 [as=c:9, outer=(8), immutable]
       └── filters
            ├── b:4 = b:8 [outer=(4,8), constraints=(/4: (/NULL - ]; /8: (/NULL - ]), fd=(4)==(8), (8)==(4)]
              └── c:5 = c:9 [outer=(5,9), constraints=(/5: (/NULL - ]; /9: (/NULL - ]), fd=(5)==(9), (9)==(5)]

@mgartner
Copy link
Collaborator

This might be where the error comes from. Notice the new ordering ordering: +(8|12|13) [actual: +12] in the inner-most inner join with fd: (12)-->(13), (8)==(12), (12)==(8), instead of (8)==(12)==(13).

 --------------------------------------------------------------------------------
 GenerateMergeJoins (higher cost)
 --------------------------------------------------------------------------------
 project
  ├── columns: a:1!null
  ├── immutable
  └── inner-join (hash)
       ├── columns: a:1!null b:4!null c:5!null b:8!null c:9!null b:12!null c:13!null
       ├── immutable
       ├── fd: (4)-->(5), (8)-->(9), (4)==(1,8,12,13), (8)==(1,4,12,13), (5)==(9), (9)==(5), (1)==(4,8,12,13), (12)==(1,4,8,13), (13)==(1,4,8,12)
       ├── project
       │    ├── columns: c:5 b:4
       │    ├── immutable
       │    ├── fd: (4)-->(5)
       │    ├── scan bc
       │    │    ├── columns: b:4
       │    │    └── computed column expressions
       │    │         └── c:5
       │    │              └── b:4 % 2
       │    └── projections
       │         └── b:4 % 2 [as=c:5, outer=(4), immutable]
-      ├── project
-      │    ├── columns: c:9 a:1!null b:8!null b:12!null c:13!null
+      ├── inner-join (merge)
+      │    ├── columns: a:1!null b:8!null c:9 b:12!null c:13!null
+      │    ├── left ordering: +8
+      │    ├── right ordering: +1
       │    ├── immutable
       │    ├── fd: (8)-->(9), (8)==(1,12,13), (12)==(1,8,13), (13)==(1,8,12), (1)==(8,12,13)
-      │    ├── inner-join (hash)
-      │    │    ├── columns: a:1!null b:8!null b:12!null c:13!null
+      │    ├── project
+      │    │    ├── columns: c:9 b:8!null b:12!null c:13!null
       │    │    ├── immutable
-      │    │    ├── fd: (12)-->(13), (8)==(1,12), (12)==(1,8), (1)==(8,12)
-      │    │    ├── scan a
-      │    │    │    └── columns: a:1
+      │    │    ├── fd: (8)-->(9), (8)==(12,13), (12)==(8,13), (13)==(8,12)
+      │    │    ├── ordering: +(8|12|13) [actual: +12]
       │    │    ├── inner-join (merge)
       │    │    │    ├── columns: b:8!null b:12!null c:13!null
       │    │    │    ├── left ordering: +12
       │    │    │    ├── right ordering: +8
       │    │    │    ├── immutable
       │    │    │    ├── fd: (12)-->(13), (8)==(12), (12)==(8)
+      │    │    │    ├── ordering: +(8|12|13) [actual: +12]
       │    │    │    ├── project
       │    │    │    │    ├── columns: c:13!null b:12!null
       │    │    │    │    ├── immutable
       │    │    │    │    ├── fd: (12)-->(13)
       │    │    │    │    ├── ordering: +12
       │    │    │    │    ├── select
       │    │    │    │    │    ├── columns: b:12!null
       │    │    │    │    │    ├── immutable
       │    │    │    │    │    ├── ordering: +12
       │    │    │    │    │    ├── scan bc@secondary
       │    │    │    │    │    │    ├── columns: b:12!null
       │    │    │    │    │    │    ├── constraint: /12/14: (/NULL - ]
       │    │    │    │    │    │    └── ordering: +12
       │    │    │    │    │    └── filters
       │    │    │    │    │         └── b:12 = (b:12 % 2) [outer=(12), immutable, constraints=(/12: (/NULL - ])]
       │    │    │    │    └── projections
       │    │    │    │         └── b:12 % 2 [as=c:13, outer=(12), immutable]
       │    │    │    ├── scan bc@secondary
       │    │    │    │    ├── columns: b:8
       │    │    │    │    └── ordering: +8
       │    │    │    └── filters (true)
-      │    │    └── filters
-      │    │         └── a:1 = b:8 [outer=(1,8), constraints=(/1: (/NULL - ]; /8: (/NULL - ]), fd=(1)==(8), (8)==(1)]
-      │    └── projections
-      │         └── b:8 % 2 [as=c:9, outer=(8), immutable]
+      │    │    └── projections
+      │    │         └── b:8 % 2 [as=c:9, outer=(8), immutable]
+      │    ├── sort
+      │    │    ├── columns: a:1
+      │    │    ├── ordering: +1
+      │    │    └── scan a
+      │    │         └── columns: a:1
+      │    └── filters (true)
       └── filters
            ├── b:4 = b:8 [outer=(4,8), constraints=(/4: (/NULL - ]; /8: (/NULL - ]), fd=(4)==(8), (8)==(4)]
            └── c:5 = c:9 [outer=(5,9), constraints=(/5: (/NULL - ]; /9: (/NULL - ]), fd=(5)==(9), (9)==(5)]

@mgartner
Copy link
Collaborator

It looks like InlineSelectVirtualColumns is partially at fault as well. I'm having difficulty understanding exactly what the problem is, but my intuition is that when InlineSelectVirtualColumns fires, a filter is pushed below a project and the FDs of the memo group aren't consistent with the new expression of the group.

@mgartner
Copy link
Collaborator

mgartner commented Apr 28, 2021

I'm fairly stumped on this one, but still making some slow progress. @RaduBerinde @rytaft let me know if you have any ideas here that might help.

It looks like the diff I posted above of GenerateMergeJoins is related to the issue. When GenerateMergeJoins fires it matches the expression:

inner-join
 ├── inner-join (hash)
 │    ├── fd: (8)-->(9), (8)==(12,13), (12)==(8,13), (13)==(8,12)
 │    ├── ...
 │    └── ...
 └── scan a

It derives an interesting ordering of +(8) for the left side, which is simplified with the left FDs to +(8|12|13), and creates a merge join.

Later, ordering.BuildChildRequired is called where parent is a Project in the same group as this merge join. It's child is an inner join with fd: (12)-->(13), (8)==(12), (12)==(8). The required ordering is +(8|12|13), and since the FD does not have an equivalence group for (8,12,13), checkRequired panics.

I think HoistProjectFromInnerJoin is the rule that adds the Project to the same group as the merge join. Is it an invalid rule because the Project doesn't really share the same FDs as the merge join, yet they exist in the same memo group. (It seems wrong for a Project to be in a memo group with fd: (8)-->(9), (8)==(12,13), (12)==(8,13), (13)==(8,12) when it's input has fd: (12)-->(13), (8)==(12), (12)==(8)).

It could be that InlineSelectVirtualColumns is an invalid rule, but seems less likely given that it's a normalization rule and doesn't add new expressions to the memo group.

@RaduBerinde
Copy link
Member

The key issue is that we end up with a plan where we first Select with filter "b:12 = (b:12+1)" and then we Project "(b:12+1)". This is equivalent to first projecting and selecting (perhaps via a join condition) which is what the normalized plan does but we can't derive the same FDs.

Unfortunately, there will always be differences like this because the FD determination can't be perfect. This is problematic given that we require the OrderingChoice groups to be equivalent. I think that (other than the assertion) in practice we would be ok because the columns are actually equal.

I think we can fix by checking for this in projectBuildChildReqOrdering (or maybe more generally in BuildChildRequired). We can modify the the required ordering for the child to only contain columns known to be equivalent: c.Group = c.Group.Intersection(rel.FuncDeps.ComputeEquivGroup(c.AnyID())). Hmm, maybe we can actually fold this into Simplify / CanSimplify, it could be as easy as:

--- a/pkg/sql/opt/props/physical/ordering_choice.go
+++ b/pkg/sql/opt/props/physical/ordering_choice.go
@@ -520,7 +520,8 @@ func (oc *OrderingChoice) CanSimplify(fdset *props.FuncDepSet) bool {
 		}
 
 		// Check whether new equivalent columns can be added by the FD set.
-		equiv := fdset.ComputeEquivClosure(group.Group)
+		equiv := fdset.ComputeEquivGroup(group.AnyID())
 		if !equiv.Equals(group.Group) {
 			return true
 		}
@@ -575,7 +576,9 @@ func (oc *OrderingChoice) Simplify(fdset *props.FuncDepSet) {
 		}
 
 		// Expand group with equivalent columns from FD set.
-		group.Group = fdset.ComputeEquivClosure(group.Group)
+		group.Group = fdset.ComputeEquivGroup(group.AnyID())
 
 		// Add this group's columns and find closure with the new columns.
 		closure = closure.Union(group.Group)

We'd need to document that Simplify can "cut both ways" - it can reduce an equality group if it doesn't jibe with the FDs.

@mgartner
Copy link
Collaborator

Hmm, maybe we can actually fold this into Simplify / CanSimplify, it could be as easy as...

Wow, that seems to work beautifully! Thanks for the help! I'll put up a PR.

mgartner added a commit to mgartner/cockroach that referenced this issue Apr 28, 2021
Previously, `OrderingChoice.Simplify` would add but never remove columns
from ordering column groups based on equivalency in an FD. In rare
cases, this could cause the optimizer to generate expressions which
violated an invariant that all columns in an ordering column group are
equivalent according to the expression's FD.

Violation of this invariant only panics in test builds, and in the test
cases found that trigger this panic, there is likely no correctness
issues with the expression. Therefore, there was probably no impact in
any release builds.

This commit updates `OrderingChoice.Simplify` so that non-equivalent
columns in an ordering column group are removed from the group,
satisfying the invariant.

Fixes cockroachdb#63794

Release note: None
@cockroach-teamcity
Copy link
Member Author

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

        		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 "char", col1_1 FLOAT4 NOT NULL, col1_2 FLOAT8 NULL, col1_3 CHAR NULL, col1_4 FLOAT8 NULL, col1_5 DECIMAL NOT NULL, col1_6 DATE NOT NULL, col1_7 JSONB, col1_8 BOX2D NOT NULL, PRIMARY KEY (col1_5 ASC), col1_9 FLOAT4 NULL AS (col1_1 + col1_4) VIRTUAL, col1_10 STRING NULL AS (lower(col1_3)) VIRTUAL, col1_11 STRING NULL AS (lower(col1_3)) STORED, col1_12 STRING NULL AS (lower(col1_3)) STORED, col1_13 FLOAT8 NULL AS (col1_2 + 0.16038397828271345:::FLOAT8) STORED, col1_14 FLOAT8 NULL AS (col1_2 + col1_1) VIRTUAL, col1_15 FLOAT8 NULL AS ((col1_2 + col1_1) + col1_4) VIRTUAL, INVERTED INDEX (col1_0 ASC, col1_5, col1_7 ASC) WHERE ((table1.col1_9 != '-Inf':::FLOAT8) AND (table1.col1_5 <= 1:::DECIMAL)) OR (table1.col1_6 < '4714-11-24 BC':::DATE), UNIQUE (col1_15 DESC, col1_14 ASC) WHERE (((((((table1.col1_15 = 3.4028234663852886e+38:::FLOAT8) AND (table1.col1_1 < '+Inf':::FLOAT8)) AND (table1.col1_5 >= '-Infinity':::DECIMAL)) AND (table1.col1_2 < 1.0:::FLOAT8)) AND (table1.col1_3 >= e'\'':::STRING)) AND (table1.col1_9 != 0.0:::FLOAT8)) OR (table1.col1_6 != 'infinity':::DATE)) OR (table1.col1_10 <= e'\x00':::STRING), FAMILY (col1_5), FAMILY (col1_13, col1_0), FAMILY (col1_2, col1_11, col1_12), FAMILY (col1_3), FAMILY (col1_4), FAMILY (col1_1), FAMILY (col1_8, col1_6, col1_7));
        CREATE TABLE table2 (col1_5 DECIMAL NOT NULL, col2_1 REGTYPE NOT NULL, col2_2 REGPROC, col2_3 DECIMAL, col2_4 REGTYPE NOT NULL, col2_5 REGTYPE NULL, col2_6 FLOAT8 NOT NULL, col2_7 REGPROCEDURE NULL, col2_8 BYTES NULL, col2_9 BOOL NOT NULL, col2_10 REGTYPE NOT NULL, col2_11 TIMESTAMP, col2_12 FLOAT4 NOT NULL, col2_13 TIMESTAMP NOT NULL, PRIMARY KEY (col1_5 ASC, col2_4 ASC), INDEX (col2_1 DESC, col2_2 DESC, col2_12 ASC, col2_13 DESC, col1_5, col2_4, col2_3 ASC) WHERE (((((table2.col2_8 = '\x00':::BYTES) OR (table2.col2_6 != 5e-324:::FLOAT8)) AND (table2.col1_5 > 1:::DECIMAL)) OR (table2.col2_11 > '3000-01-01 00:00:00':::TIMESTAMP)) AND (table2.col2_12 != '-Inf':::FLOAT8)) OR (table2.col2_13 != '-2000-01-01 00:00:00':::TIMESTAMP), INDEX (col2_13 DESC, col2_10, col2_11 DESC, col2_6, col2_4 DESC, col1_5, col2_7 DESC, col2_5, col2_9 ASC, col2_2 DESC, col2_12 ASC), INDEX (col2_13, col2_10 ASC, col2_5, col2_6, col1_5, col2_9, col2_8 DESC, col2_7, col2_12, col2_2 DESC, col2_11 ASC, col2_1) STORING (col2_3)) INTERLEAVE IN PARENT table1 (col1_5);
        CREATE TABLE table3 (col3_0 REGPROCEDURE NULL, col3_1 JSONB NOT NULL, col3_2 BOX2D, col3_3 DECIMAL NOT NULL, col3_4 STRING, col3_5 CHAR NOT NULL, col3_6 GEOMETRY NOT NULL, col3_7 BIT(31) NOT NULL, col3_8 INTERVAL NOT NULL, col3_9 NAME NOT NULL, PRIMARY KEY (col3_3, col3_5 ASC, col3_9, col3_7 DESC), col3_10 DECIMAL NOT NULL AS (col3_3 + 0.07172563998787407027:::DECIMAL) VIRTUAL, col3_11 STRING NOT NULL AS (lower(CAST(col3_7 AS STRING))) VIRTUAL, col3_12 STRING NOT NULL AS (lower(CAST(col3_6 AS STRING))) STORED, col3_13 STRING NOT NULL AS (lower(CAST(col3_6 AS STRING))) VIRTUAL);
        CREATE TABLE table4 (col4_0 DECIMAL NOT NULL, col4_1 "char" NOT NULL, col4_2 TIME NOT NULL, col4_3 TIMESTAMPTZ, col4_4 TIMETZ NOT NULL, col4_5 REGCLASS NOT NULL, col4_6 REGPROCEDURE NOT NULL, col4_7 INET NOT NULL, col4_8 REGPROCEDURE NOT NULL, PRIMARY KEY (col4_4, col4_7, col4_1 DESC, col4_0 DESC, col4_6, col4_2 ASC), col4_9 STRING NOT NULL AS (lower(CAST(col4_4 AS STRING))) STORED, col4_10 STRING NOT NULL AS (lower(col4_1)) STORED, col4_11 STRING NOT NULL AS (lower(CAST(col4_7 AS STRING))) VIRTUAL, col4_12 STRING NOT NULL AS (lower(CAST(col4_5 AS STRING))) VIRTUAL, col4_13 STRING NOT NULL AS (lower(CAST(col4_6 AS STRING))) VIRTUAL, col4_14 STRING NOT NULL AS (lower(CAST(col4_4 AS STRING))) VIRTUAL, col4_15 STRING NOT NULL AS (lower(CAST(col4_8 AS STRING))) STORED, INDEX (col4_4, col4_11, col4_0, col4_15, col4_3 ASC, col4_7 ASC, col4_9 ASC, col4_1 ASC, col4_2) WHERE ((((((table4.col4_9 <= '':::STRING) OR (table4.col4_0 <= 'NaN':::DECIMAL)) OR (table4.col4_3 <= '-4713-11-24 00:00:00+00:00':::TIMESTAMPTZ)) OR (table4.col4_4 <= '00:00:00+15:59:00':::TIMETZ)) AND (table4.col4_11 <= e'\x00':::STRING)) OR (table4.col4_15 >= e'\x00':::STRING)) OR (table4.col4_13 != e'\'':::STRING), INDEX (col4_11 ASC, col4_9 ASC, col4_8, col4_0, col4_14, col4_1 ASC, col4_2 DESC, col4_7, col4_3, col4_13, col4_4 ASC, col4_15, col4_10 ASC, col4_5) WHERE ((((((((((table4.col4_13 != '"':::STRING) OR (table4.col4_15 = 'X':::STRING)) AND (table4.col4_2 <= '24:00:00':::TIME)) OR (table4.col4_3 > '-4713-11-24 00:00:00+00:00':::TIMESTAMPTZ)) AND (table4.col4_10 = e'\x00':::STRING)) OR (table4.col4_11 >= 'X':::STRING)) OR (table4.col4_0 < 0:::DECIMAL)) AND (table4.col4_12 != '':::STRING)) OR (table4.col4_4 < '00:00:00+15:59:00':::TIMETZ)) AND (table4.col4_9 = '"':::STRING)) AND (table4.col4_14 < '':::STRING), INDEX (col4_6, col4_3 DESC, col4_9 DESC, col4_12 DESC, col4_8 DESC, col4_7 ASC, col4_13) WHERE (((((((((((table4.col4_13 != e'\U00002603':::STRING) AND (table4.col4_14 < e'\x00':::STRING)) OR (table4.col4_11 = '':::STRING)) OR (table4.col4_0 != '-Infinity':::DECIMAL)) OR (table4.col4_9 <= '"':::STRING)) AND (table4.col4_12 >= '':::STRING)) AND (table4.col4_4 >= '24:00:00-15:59:00':::TIMETZ)) AND (table4.col4_15 != 'X':::STRING)) OR (table4.col4_3 != '-2000-01-01 00:00:00+00:00':::TIMESTAMPTZ)) OR (table4.col4_2 <= '24:00:00':::TIME)) OR (table4.col4_1 < '':::STRING)) OR (table4.col4_10 > e'\U00002603':::STRING), INDEX (col4_5 DESC) WHERE (((((((((((table4.col4_11 >= e'\x00':::STRING) AND (table4.col4_1 > '':::STRING)) AND (table4.col4_3 >= '-4713-11-24 00:00:00+00:00':::TIMESTAMPTZ)) AND (table4.col4_0 > 'NaN':::DECIMAL)) AND (table4.col4_15 > e'\x00':::STRING)) OR (table4.col4_4 >= '24:00:00-15:59:00':::TIMETZ)) AND (table4.col4_10 >= e'\'':::STRING)) OR (table4.col4_9 = '':::STRING)) AND (table4.col4_13 > e'\x00':::STRING)) AND (table4.col4_12 < '':::STRING)) AND (table4.col4_2 != '24:00:00':::TIME)) OR (table4.col4_14 >= '':::STRING), INDEX (col4_15 DESC, col4_11 ASC, col4_9, col4_4 DESC, col4_6) STORING (col4_3, col4_5, col4_8), INDEX (col4_4, col4_15 DESC, col4_14 ASC, col4_8, col4_11, col4_3 DESC, col4_13 ASC, col4_2, col4_6 ASC, col4_12 DESC, col4_1, col4_9, col4_0 ASC, col4_7 DESC) WHERE ((((table4.col4_11 > '':::STRING) OR (table4.col4_9 > e'\'':::STRING)) OR (table4.col4_0 = 'NaN':::DECIMAL)) AND (table4.col4_10 < 'X':::STRING)) AND (table4.col4_15 != 'X':::STRING), UNIQUE (col4_8 DESC, col4_2, col4_3 ASC, col4_9 DESC, col4_14), UNIQUE (col4_14, col4_7 DESC) STORING (col4_8, col4_15) WHERE (((((((table4.col4_12 <= e'\U00002603':::STRING) AND (table4.col4_9 != e'\x00':::STRING)) AND (table4.col4_0 > 'NaN':::DECIMAL)) OR (table4.col4_4 > '00:00:00+15:59:00':::TIMETZ)) OR (table4.col4_1 != 'X':::STRING)) AND (table4.col4_10 <= e'\'':::STRING)) OR (table4.col4_11 < 'X':::STRING)) OR (table4.col4_13 > e'\x00':::STRING));
        CREATE TABLE table5 (col3_3 DECIMAL NOT NULL, col3_5 CHAR NOT NULL, col3_9 NAME NOT NULL, col3_7 BIT(31) NOT NULL, col5_4 INT2 NULL, col5_5 FLOAT4 NOT NULL, col5_6 INT4, PRIMARY KEY (col3_3, col3_5 ASC, col3_9, col3_7 DESC), INDEX (col3_3 DESC, col5_4 ASC, col5_6 DESC) WHERE (((((table5.col5_6 >= 1:::INT8) OR (table5.col3_5 < e'\U00002603':::STRING)) OR (table5.col5_4 < 0:::INT8)) AND (table5.col3_9 != e'\'':::STRING)) AND (table5.col5_5 <= 0.0:::FLOAT8)) AND (table5.col3_3 <= 'Infinity':::DECIMAL), INDEX (col5_5 ASC, col5_4 ASC, col5_6 DESC, col3_5 ASC), INDEX (col5_4 DESC, col3_3 DESC, col3_5 ASC, col5_5 ASC, col3_9 ASC) STORING (col5_6), FAMILY (col3_9, col3_3, col5_5, col5_6), FAMILY (col5_4, col3_7, col3_5)) INTERLEAVE IN PARENT table3 (col3_3, col3_5, col3_9, col3_7);
        ALTER TABLE table1 INJECT STATISTICS '[{"columns": ["col1_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1841131682, "histo_col_type": "", "name": "__auto__", "null_count": 318686504, "row_count": 5000000000}, {"columns": ["col1_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2399968616, "histo_col_type": "", "name": "__auto__", "null_count": 242171078, "row_count": 5000000000}, {"columns": ["col1_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4841631219, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000000}, {"columns": ["col1_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1118061233, "histo_col_type": "", "name": "__auto__", "null_count": 2276306171, "row_count": 5000000000}, {"columns": ["col1_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4792198343, "histo_col_type": "", "name": "__auto__", "null_count": 3508029420, "row_count": 5000000000}, {"columns": ["col1_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1713789826, "histo_col_type": "", "name": "__auto__", "null_count": 2810023745, "row_count": 5000000000}, {"columns": ["col1_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1672040930, "histo_buckets": [{"distinct_range": 0, "num_eq": 900, "num_range": 0, "upper_bound": "-1.0848679188904309"}, {"distinct_range": 400000, "num_eq": 10000000, "num_range": 400000, "upper_bound": "0.2475618498000772"}, {"distinct_range": 0, "num_eq": 10000000, "num_range": 80000, "upper_bound": "0.2684535358344373"}, {"distinct_range": 0, "num_eq": 300, "num_range": 50000000, "upper_bound": "0.36323652840109244"}, {"distinct_range": 6649561149285130000, "num_eq": 535137985119372136, "num_range": 6649561149285130350, "upper_bound": "2.17644648253826"}], "histo_col_type": "FLOAT8", "name": "__auto__", "null_count": 3697049896, "row_count": 5000000000}, {"columns": ["col1_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3174619513, "histo_col_type": "", "name": "__auto__", "null_count": 686032453, "row_count": 5000000000}, {"columns": ["col1_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 663306644, "histo_col_type": "", "name": "__auto__", "null_count": 993237565, "row_count": 5000000000}, {"columns": ["col1_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 441207866, "histo_col_type": "", "name": "__auto__", "null_count": 328359701, "row_count": 5000000000}, {"columns": ["col1_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 746433014, "histo_col_type": "", "name": "__auto__", "null_count": 4095533297, "row_count": 5000000000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 2945243818, "histo_buckets": [{"distinct_range": 0, "num_eq": 800000, "num_range": 0, "upper_bound": "-2.869768264744353926E+32"}, {"distinct_range": 100, "num_eq": 90000, "num_range": 100, "upper_bound": "-1311793671775972.872"}, {"distinct_range": 7185710766782980000, "num_eq": 90000, "num_range": 7456237309935553908, "upper_bound": "-2541926448.987302933"}, {"distinct_range": 2087.4371689321893, "num_eq": 6406207722991990935, "num_range": 4000, "upper_bound": "2.624364887697527939E+21"}, {"distinct_range": 282.33813318533504, "num_eq": 5373525935897824899, "num_range": 400, "upper_bound": "2.763669739373908651E+29"}, {"distinct_range": 3196212558710936600, "num_eq": 2915020700144839594, "num_range": 8813733997396838446, "upper_bound": "4.59979294886431842E+29"}, {"distinct_range": 0, "num_eq": 900000, "num_range": 50000000, "upper_bound": "2.814907333809015349E+31"}], "histo_col_type": "DECIMAL", "name": "__auto__", "null_count": 0, "row_count": 5000000000}, {"columns": ["col1_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4244105881, "histo_col_type": "", "name": "__auto__", "null_count": 2364036266, "row_count": 5000000000}, {"columns": ["col1_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1368810137, "histo_col_type": "", "name": "__auto__", "null_count": 3625183544, "row_count": 5000000000}, {"columns": ["col1_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1399129046, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000000}, {"columns": ["col1_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 4258372748, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 5000000000}]':::JSONB;
        ALTER TABLE table2 INJECT STATISTICS '[{"columns": ["col2_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 653641083, "histo_col_type": "", "name": "__auto__", "null_count": 206399426, "row_count": 900000000}, {"columns": ["col2_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 332994741, "histo_col_type": "", "name": "__auto__", "null_count": 796620591, "row_count": 900000000}, {"columns": ["col2_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 353242279, "histo_buckets": [{"distinct_range": 0, "num_eq": 6860584002367923906, "num_range": 0, "upper_bound": "1983-03-13 04:00:07.000121"}, {"distinct_range": 788038.9672951002, "num_eq": 100000000, "num_range": 1000000, "upper_bound": "1985-10-27 09:36:29.000018"}, {"distinct_range": 0, "num_eq": 9000, "num_range": 0, "upper_bound": "2005-07-03 20:38:07.000972"}, {"distinct_range": 2346603363779819000, "num_eq": 30000000, "num_range": 2346603363779818771, "upper_bound": "2017-05-25 22:05:53.000739"}, {"distinct_range": 0, "num_eq": 800000, "num_range": 1000000000, "upper_bound": "2017-08-08 03:51:35.000444"}], "histo_col_type": "TIMESTAMP", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col1_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 397616723, "histo_buckets": [{"distinct_range": 0, "num_eq": 2000000000, "num_range": 0, "upper_bound": "-7.891461887485014271E+32"}, {"distinct_range": 40000000000, "num_eq": 7000, "num_range": 40000000000, "upper_bound": "-7603447.219079232069"}, {"distinct_range": 0, "num_eq": 70000000000, "num_range": 8506736102870021131, "upper_bound": "220984.1957930540392"}, {"distinct_range": 0, "num_eq": 7159931572877229983, "num_range": 0, "upper_bound": "8729301289901826.548"}], "histo_col_type": "DECIMAL", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col2_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 857292410, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col2_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 702017115, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col2_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 528231374, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col2_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 146232293, "histo_buckets": [{"distinct_range": 0, "num_eq": 40000, "num_range": 0, "upper_bound": "960457286"}, {"distinct_range": 6000, "num_eq": 100000000, "num_range": 6000, "upper_bound": "1991935282"}, {"distinct_range": 3636608531171348500, "num_eq": 1000000, "num_range": 3636608531171348602, "upper_bound": "3878346248"}], "histo_col_type": "REGTYPE", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col2_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 512082844, "histo_col_type": "", "name": "__auto__", "null_count": 142449427, "row_count": 900000000}, {"columns": ["col2_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 141550762, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col2_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 719472488, "histo_col_type": "", "name": "__auto__", "null_count": 164652730, "row_count": 900000000}, {"columns": ["col2_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 288504803, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 900000000}, {"columns": ["col2_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 509487852, "histo_col_type": "", "name": "__auto__", "null_count": 791868096, "row_count": 900000000}, {"columns": ["col2_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 777022227, "histo_col_type": "", "name": "__auto__", "null_count": 125367738, "row_count": 900000000}]':::JSONB;
        ALTER TABLE table3 INJECT STATISTICS '[{"columns": ["col3_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 28, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200}, {"columns": ["col3_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 139, "histo_col_type": "", "name": "__auto__", "null_count": 15, "row_count": 200}, {"columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 96, "histo_buckets": [{"distinct_range": 0, "num_eq": 40, "num_range": 0, "upper_bound": "-6.85627711376763577E+20"}, {"distinct_range": 5946140.612738646, "num_eq": 7793833834118580685, "num_range": 6000000, "upper_bound": "-87013834770275029.82"}, {"distinct_range": 0, "num_eq": 3341790319637430886, "num_range": 40000000, "upper_bound": "-674935637970.3431451"}, {"distinct_range": 4250794067765795000, "num_eq": 10000, "num_range": 4250794067765795027, "upper_bound": "-627980043.0552418168"}, {"distinct_range": 0, "num_eq": 3000000000, "num_range": 600000, "upper_bound": "-65431.5469099907376"}, {"distinct_range": 60482674137.27379, "num_eq": 50000000000, "num_range": 90000000000, "upper_bound": "4.781448997074099484"}, {"distinct_range": 21269604732.96669, "num_eq": 6141966836237211340, "num_range": 40000000000, "upper_bound": "4.971508825651549677E+31"}, {"distinct_range": 0, "num_eq": 7000, "num_range": 300000000, "upper_bound": "5.980018202368939114E+37"}], "histo_col_type": "DECIMAL", "name": "__auto__", "null_count": 0, "row_count": 200}, {"columns": ["col3_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 77, "histo_col_type": "", "name": "__auto__", "null_count": 98, "row_count": 200}, {"columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 180, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200}, {"columns": ["col3_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 88, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200}, {"columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 89, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200}, {"columns": ["col3_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 91, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200}, {"columns": ["col3_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 14, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200}, {"columns": ["col3_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 47, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200}, {"columns": ["col3_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 96, "histo_col_type": "", "name": "__auto__", "null_count": 122, "row_count": 200}, {"columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 103, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200}, {"columns": ["col3_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 62, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200}, {"columns": ["col3_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 84, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 200}]':::JSONB;
        ALTER TABLE table4 INJECT STATISTICS '[{"columns": ["col4_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 262487, "histo_buckets": [{"distinct_range": 0, "num_eq": 1058781913391282843, "num_range": 0, "upper_bound": "0"}, {"distinct_range": 0, "num_eq": 20000000, "num_range": 5506507986972221366, "upper_bound": "79387641"}, {"distinct_range": 367022127151692540, "num_eq": 90000000000, "num_range": 590380440627733388, "upper_bound": "1444417675"}, {"distinct_range": 738513787.5817461, "num_eq": 3000000, "num_range": 900000000, "upper_bound": "1675774513"}, {"distinct_range": 0, "num_eq": 3000, "num_range": 4023079569747859165, "upper_bound": "2070611763"}, {"distinct_range": 0, "num_eq": 5972743174291083366, "num_range": 2000000, "upper_bound": "2455541465"}], "histo_col_type": "REGPROCEDURE", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 3027, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_13"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 51563, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_0"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 355126, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_2"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 489396, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 144891, "histo_col_type": "", "name": "__auto__", "null_count": 299, "row_count": 500000}, {"columns": ["col4_11"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 494284, "histo_col_type": "STRING", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_1"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 164134, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 35424, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_8"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 438637, "histo_col_type": "REGPROCEDURE", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_12"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 73950, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_14"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 146806, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 216160, "histo_buckets": [{"distinct_range": 0, "num_eq": 4941198839148073461, "num_range": 0, "upper_bound": "00:00:00+15:59:00"}, {"distinct_range": 0, "num_eq": 3571096188541083850, "num_range": 0, "upper_bound": "01:20:58.468133-10:27:00"}, {"distinct_range": 0, "num_eq": 7811976298745262617, "num_range": 60000000000, "upper_bound": "06:38:52.7956-07:21:00"}, {"distinct_range": 0, "num_eq": 300, "num_range": 0, "upper_bound": "16:53:54.302153-10:19:00"}, {"distinct_range": 2801981274496386600, "num_eq": 10000000, "num_range": 2801981274496386745, "upper_bound": "24:00:00-15:59:00"}], "histo_col_type": "TIMETZ", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 241291, "histo_buckets": [{"distinct_range": 0, "num_eq": 2000000, "num_range": 0, "upper_bound": "2338463284"}], "histo_col_type": "REGCLASS", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_10"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 430888, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}, {"columns": ["col4_15"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 292734, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 500000}]':::JSONB;
        ALTER TABLE table5 INJECT STATISTICS '[{"columns": ["col3_3"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 420020344332735185, "histo_buckets": [{"distinct_range": 0, "num_eq": 30000000000, "num_range": 0, "upper_bound": "NaN"}, {"distinct_range": 0, "num_eq": 10000000, "num_range": 5955136693015300159, "upper_bound": "-6.707200236769491231E+31"}, {"distinct_range": 7536328999756114000, "num_eq": 4383066393934327245, "num_range": 7536328999756114124, "upper_bound": "-7531616118669080327"}, {"distinct_range": 0, "num_eq": 5000000000, "num_range": 5679577009719149943, "upper_bound": "-481268123238839876.5"}, {"distinct_range": 965062122088915700, "num_eq": 7471803012955873694, "num_range": 1989068085897436436, "upper_bound": "-456187509213982.0383"}, {"distinct_range": 70000000, "num_eq": 7104113383579544797, "num_range": 70000000, "upper_bound": "-5777944426378.209166"}, {"distinct_range": 5275593141.771377, "num_eq": 313307050526373405, "num_range": 7000000000, "upper_bound": "-88579.52230490936593"}, {"distinct_range": 0, "num_eq": 142667448026926337, "num_range": 500000000, "upper_bound": "735981811794665645.2"}, {"distinct_range": 319.8330273874822, "num_eq": 8611985777556951852, "num_range": 700, "upper_bound": "7.98078604112423397E+33"}], "histo_col_type": "DECIMAL", "name": "__auto__", "null_count": 0, "row_count": 3406303765596526085}, {"columns": ["col3_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1254682920371904343, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3406303765596526085}, {"columns": ["col3_9"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 255922385758415625, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3406303765596526085}, {"columns": ["col3_7"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 477763954267359969, "histo_col_type": "", "name": "__auto__", "null_count": 0, "row_count": 3406303765596526085}, {"columns": ["col5_4"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1176934543591033902, "histo_buckets": [{"distinct_range": 0, "num_eq": 1000000000, "num_range": 0, "upper_bound": "-12174"}, {"distinct_range": 5510707253668426000, "num_eq": 1135316850514229823, "num_range": 5510707253668426105, "upper_bound": "-1918"}, {"distinct_range": 750.3629889010697, "num_eq": 9200579834135269385, "num_range": 800, "upper_bound": "8279"}], "histo_col_type": "INT2", "name": "__auto__", "null_count": 74806652995150428, "row_count": 3406303765596526085}, {"columns": ["col5_5"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1212577899168935758, "histo_buckets": [{"distinct_range": 0, "num_eq": 30000, "num_range": 0, "upper_bound": "NaN"}, {"distinct_range": 2455969531600430000, "num_eq": 7367077675209329000, "num_range": 2455969531600429824, "upper_bound": "-1.209553837776184"}, {"distinct_range": 1839291212550332400, "num_eq": 1000, "num_range": 5616703525891618064, "upper_bound": "-0.8566023111343384"}, {"distinct_range": 0, "num_eq": 900, "num_range": 10000000000, "upper_bound": "-0.4546944499015808"}, {"distinct_range": 0, "num_eq": 0, "num_range": 1000000000, "upper_bound": "0.05879819393157959"}, {"distinct_range": 8073837593300248000, "num_eq": 400000000, "num_range": 8073837593300247142, "upper_bound": "1.8928271532058716"}], "histo_col_type": "FLOAT4", "name": "__auto__", "null_count": 0, "row_count": 3406303765596526085}, {"columns": ["col5_6"], "created_at": "2000-01-01 00:00:00+00:00", "distinct_count": 1489884408580952628, "histo_col_type": "", "name": "__auto__", "null_count": 3086135067334862509, "row_count": 3406303765596526085}]':::JSONB;
        CREATE TYPE rand_typ_0 AS ENUM ('gzub', 'e', 'l', 'q', 'n');
        ;
    rsg_test.go:577: 
        SET CLUSTER SETTING sql.defaults.drop_enum_value.enabled = true;
        SET enable_drop_enum_value = true;
        
        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:579: 
    rsg_test.go:580: -- test log scope end --
test logs left over in: /go/src/github.com/cockroachdb/cockroach/artifacts/logTestRandomSyntaxSQLSmith213851391
--- FAIL: TestRandomSyntaxSQLSmith (354.13s)
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 @rafiss

This test on roachdash | Improve this report!

mgartner added a commit to mgartner/cockroach that referenced this issue Apr 28, 2021
Previously, `OrderingChoice.Simplify` would add but never remove columns
from ordering column groups based on equivalency in an FD. In rare
cases, this could cause the optimizer to generate expressions which
violated an invariant that all columns in an ordering column group are
equivalent according to the expression's FD.

Violation of this invariant only panics in test builds, and in the test
cases found that trigger this panic, there is likely no correctness
issues with the expression. Therefore, there was probably no impact in
any release builds.

This commit updates `OrderingChoice.Simplify` so that non-equivalent
columns in an ordering column group are removed from the group,
satisfying the invariant.

Fixes cockroachdb#63794

Release note: None
craig bot pushed a commit that referenced this issue Apr 28, 2021
64253: builtins: implement ST_Envelope(box2d) r=sumeerbhola a=otan

Release note (sql change): Implement ST_Envelope for Box2D.

64265: kvserver: speed up intent resolution for aborted txns r=sumeerbhola a=erikgrinaker

### kvserver: speed up intent resolution for aborted txns

Cleaning up intents for aborted txns during `EndTxn` could be very slow
for intents that had already been removed by a concurrent process, due
to suboptimal iterator reuse.

This patch changes this intent resolution path to instead create a new
iterator with `Prefix:true` for each intent rather than seeking a
reusable iterator. This reduces intent resolution time by two orders of
magnitude (~200s → ~1s in tests). A simple performance regression test
has been added for this.

Resolves #64092.

Release note (performance improvement): improved intent cleanup
performance for aborted transactions.

### intentresolver: reduce ranged resolution batch size

This patch adds the constants `intentResolverRangeBatchSize` and
`intentResolverRangeRequestSize` to control the number of requests and
number of intents per request for ranged intent resolution. It also
reduces the number of range requests per batch from 100 to 10, since
ranged requests can fan out to hit 200 intents each (via range scans)
which is significantly more expensive than single-intent requests.

Release note: None

/cc @cockroachdb/kv 

64324: kvserver: synchronize replica removal with read-only requests r=tbg,nvanbenschoten a=erikgrinaker

Replica removal did not synchronize with in-flight read-only requests,
which could cause them to be evaluated on a removed (empty) replica,
returning an empty result.

This patch fixes the problem by locking `Replica.readOnlyCmdMu` during
replica removal, thus either waiting for read-only requests to complete
or not evaluating them.

Resolves #64325.

Release note (bug fix): Fixed a race condition where read-only requests
during replica removal (e.g. during range merges or rebalancing) could
be evaluated on the removed replica, returning an empty result.

/cc @cockroachdb/kv 

We lock `readOnlyCmdMu` during `removeUninitializedReplicaRaftMuLocked` and `tryGetOrCreateReplica` as well, even though I don't believe reads can be routed to these replicas, following review comments.

64342: opt: remove non-equivalent group columns in OrderingChoice.Simplify r=mgartner a=mgartner

Previously, `OrderingChoice.Simplify` would add but never remove columns
from ordering column groups based on equivalency in an FD. In rare
cases, this could cause the optimizer to generate expressions which
violated an invariant that all columns in an ordering column group are
equivalent according to the expression's FD.

Violation of this invariant only panics in test builds, and in the test
cases found that trigger this panic, there is likely no correctness
issues with the expression. Therefore, there was probably no impact in
any release builds.

This commit updates `OrderingChoice.Simplify` so that non-equivalent
columns in an ordering column group are removed from the group,
satisfying the invariant.

Fixes #63794

Release note: None

Co-authored-by: Oliver Tan <[email protected]>
Co-authored-by: Erik Grinaker <[email protected]>
Co-authored-by: Marcus Gartner <[email protected]>
@craig craig bot closed this as completed in ecfff8c Apr 28, 2021
@mgartner mgartner moved this to Done in SQL Queries Jul 24, 2023
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.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants