misc.python.materialize.sqlsmith

  1# Copyright Materialize, Inc. and contributors. All rights reserved.
  2#
  3# Use of this software is governed by the Business Source License
  4# included in the LICENSE file at the root of this repository.
  5#
  6# As of the Change Date specified in that file, in accordance with
  7# the Business Source License, use of this software will be governed
  8# by the Apache License, Version 2.0.
  9
 10# These are only errors which have no associated issues since they are not
 11# considered product bugs, but SQLsmith generating bad queries. Use ci-regexp
 12# in Github issues for actual product bugs.
 13known_errors = [
 14    "no connection to the server",  # Expected AFTER a crash, the query before this is interesting, not the ones after
 15    "failed: Connection refused",  # Expected AFTER a crash, the query before this is interesting, not the ones after
 16    "could not translate host name",  # Expected AFTER a crash, the query before this is interesting, not the ones after
 17    "canceling statement due to statement timeout",
 18    "value too long for type",
 19    "list_agg on char not yet supported",
 20    "does not allow subqueries",
 21    "function array_remove(",  # insufficient type system, parameter types have to match
 22    "function array_cat(",  # insufficient type system, parameter types have to match
 23    "function array_position(",  # insufficient type system, parameter types have to match
 24    "function list_append(",  # insufficient type system, parameter types have to match
 25    "function list_prepend(",  # insufficient type system, parameter types have to match
 26    "function list_cat(",  # insufficient type system, parameter types have to match
 27    "does not support implicitly casting from",
 28    "aggregate functions that refer exclusively to outer columns not yet supported",  # https://github.com/MaterializeInc/database-issues/issues/1163
 29    "range lower bound must be less than or equal to range upper bound",
 30    "violates not-null constraint",
 31    "division by zero",
 32    "zero raised to a negative power is undefined",
 33    "operator does not exist",  # For list types
 34    "couldn't parse role id",
 35    "mz_aclitem grantor cannot be PUBLIC role",
 36    "unrecognized privilege type:",
 37    "cannot return complex numbers",
 38    "statement batch size cannot exceed",
 39    "length must be nonnegative",
 40    "is only defined for finite arguments",
 41    "more than one record produced in subquery",
 42    "invalid range bound flags",
 43    "invalid input syntax for type jsonb",
 44    "invalid regular expression",
 45    "invalid input syntax for type date",
 46    "invalid escape string",
 47    "invalid hash algorithm",
 48    "is defined for numbers greater than or equal to",
 49    "is not defined for zero",
 50    "is not defined for negative numbers",
 51    "requested character too large for encoding",
 52    "requested character not valid for encoding",
 53    "internal error: unrecognized configuration parameter",
 54    "invalid encoding name",
 55    "invalid time zone",
 56    "value out of range: overflow",
 57    "value out of range: underflow",
 58    "LIKE pattern exceeds maximum length",
 59    "negative substring length not allowed",
 60    "cannot take square root of a negative number",
 61    "timestamp units not yet supported",
 62    "step size cannot equal zero",
 63    "stride must be greater than zero",
 64    "timestamp out of range",
 65    "integer out of range",
 66    "unterminated escape sequence in LIKE",
 67    "null character not permitted",
 68    "is defined for numbers between",
 69    "field position must be greater than zero",
 70    "array_fill on ",  # Not yet supported
 71    "must not be null",  # Expected with array_fill, array_position
 72    "' not recognized",  # Expected, see https://github.com/MaterializeInc/database-issues/issues/5253
 73    "must appear in the GROUP BY clause or be used in an aggregate function",
 74    "Expected joined table, found",  # Should fix for multi table join
 75    "Expected ON, or USING after JOIN, found",  # Should fix for multi table join
 76    "but expression is of type",  # Should fix, but only happens rarely
 77    "coalesce could not convert type map",  # Should fix, but only happens rarely
 78    "operator does not exist: map",  # Should fix, but only happens rarely
 79    "result exceeds max size of",  # Seems expected with huge queries
 80    "expected expression, but found reserved keyword",  # Should fix, but only happens rarely with subqueries
 81    "Expected right parenthesis, found left parenthesis",  # Should fix, but only happens rarely with cast+coalesce
 82    "invalid selection: operation may only refer to user-defined tables",  # Seems expected when using catalog tables
 83    "Unsupported temporal predicate",  # Expected, see https://github.com/MaterializeInc/database-issues/issues/5288
 84    "OneShot plan has temporal constraints",  # Expected, see https://github.com/MaterializeInc/database-issues/issues/5288
 85    "internal error: cannot evaluate unmaterializable function",  # Currently expected, see https://github.com/MaterializeInc/database-issues/issues/4083
 86    "string is not a valid identifier:",  # Expected in parse_ident & quote_ident
 87    "invalid datepart",
 88    "pg_cancel_backend in this position not yet supported",
 89    "unrecognized configuration parameter",
 90    "numeric field overflow",
 91    "bigint out of range",
 92    "smallint out of range",
 93    "uint8 out of range",
 94    "uint4 out of range",
 95    "uint2 out of range",
 96    "interval out of range",
 97    "timezone interval must not contain months or years",
 98    "not supported for type date",
 99    "not supported for type time",
100    "coalesce types text and text list cannot be matched",  # Bad typing for ||
101    "coalesce types text list and text cannot be matched",  # Bad typing for ||
102    "is out of range for type numeric: exceeds maximum precision",
103    "CAST does not support casting from ",  # TODO: Improve type system
104    "SET clause does not support casting from ",  # TODO: Improve type system
105    "coalesce types integer and interval cannot be matched",  # TODO: Implicit cast from timestamp to date in (date - timestamp)
106    "coalesce types interval and integer cannot be matched",  # TODO: Implicit cast from timestamp to date in (date - timestamp)
107    "requested length too large",
108    "number of columns must be a positive integer literal",
109    "regexp_extract requires a string literal as its first argument",
110    "regex parse error",
111    "out of valid range",
112    '" does not exist',  # role does not exist
113    "attempt to create relation with too many columns",
114    "target replica failed or was dropped",  # expected on replica OoMs with materialize#21587
115    "cannot materialize call to",  # create materialized view on some internal views
116    "arrays must not contain null values",  # aclexplode, mz_aclexplode
117    "OVER clause not allowed on",  # window functions
118    "cannot reference pseudo type",
119    "window functions are not allowed in table function arguments",  # TODO: Remove when database-issues#6317 is implemented
120    "window functions are not allowed in OR argument",  # wrong error message
121    "window functions are not allowed in AND argument",  # wrong error message
122    "window functions are not allowed in aggregate function",
123    "invalid IANA Time Zone Database identifier",
124    "Top-level LIMIT must be a constant expression",
125    "LIMIT must not be negative",
126    "materialized view objects cannot depend on log sources",  # explain create materialized view
127    "aggregate functions are not allowed in OR argument",
128    "aggregate functions are not allowed in AND argument",
129    "aggregate functions are not allowed in WHERE clause",
130    "aggregate functions are not allowed in table function arguments",
131    "aggregate functions are not allowed in LIMIT",
132    "nested aggregate functions are not allowed",
133    "function map_build(text list) does not exist",
134    "timestamp cannot be NaN",
135    "exceeded recursion limit of 2048",
136    "key cannot be null",  # expected, see PR materialize#25941
137    "regexp_extract must specify at least one capture group",
138]
known_errors = ['no connection to the server', 'failed: Connection refused', 'could not translate host name', 'canceling statement due to statement timeout', 'value too long for type', 'list_agg on char not yet supported', 'does not allow subqueries', 'function array_remove(', 'function array_cat(', 'function array_position(', 'function list_append(', 'function list_prepend(', 'function list_cat(', 'does not support implicitly casting from', 'aggregate functions that refer exclusively to outer columns not yet supported', 'range lower bound must be less than or equal to range upper bound', 'violates not-null constraint', 'division by zero', 'zero raised to a negative power is undefined', 'operator does not exist', "couldn't parse role id", 'mz_aclitem grantor cannot be PUBLIC role', 'unrecognized privilege type:', 'cannot return complex numbers', 'statement batch size cannot exceed', 'length must be nonnegative', 'is only defined for finite arguments', 'more than one record produced in subquery', 'invalid range bound flags', 'invalid input syntax for type jsonb', 'invalid regular expression', 'invalid input syntax for type date', 'invalid escape string', 'invalid hash algorithm', 'is defined for numbers greater than or equal to', 'is not defined for zero', 'is not defined for negative numbers', 'requested character too large for encoding', 'requested character not valid for encoding', 'internal error: unrecognized configuration parameter', 'invalid encoding name', 'invalid time zone', 'value out of range: overflow', 'value out of range: underflow', 'LIKE pattern exceeds maximum length', 'negative substring length not allowed', 'cannot take square root of a negative number', 'timestamp units not yet supported', 'step size cannot equal zero', 'stride must be greater than zero', 'timestamp out of range', 'integer out of range', 'unterminated escape sequence in LIKE', 'null character not permitted', 'is defined for numbers between', 'field position must be greater than zero', 'array_fill on ', 'must not be null', "' not recognized", 'must appear in the GROUP BY clause or be used in an aggregate function', 'Expected joined table, found', 'Expected ON, or USING after JOIN, found', 'but expression is of type', 'coalesce could not convert type map', 'operator does not exist: map', 'result exceeds max size of', 'expected expression, but found reserved keyword', 'Expected right parenthesis, found left parenthesis', 'invalid selection: operation may only refer to user-defined tables', 'Unsupported temporal predicate', 'OneShot plan has temporal constraints', 'internal error: cannot evaluate unmaterializable function', 'string is not a valid identifier:', 'invalid datepart', 'pg_cancel_backend in this position not yet supported', 'unrecognized configuration parameter', 'numeric field overflow', 'bigint out of range', 'smallint out of range', 'uint8 out of range', 'uint4 out of range', 'uint2 out of range', 'interval out of range', 'timezone interval must not contain months or years', 'not supported for type date', 'not supported for type time', 'coalesce types text and text list cannot be matched', 'coalesce types text list and text cannot be matched', 'is out of range for type numeric: exceeds maximum precision', 'CAST does not support casting from ', 'SET clause does not support casting from ', 'coalesce types integer and interval cannot be matched', 'coalesce types interval and integer cannot be matched', 'requested length too large', 'number of columns must be a positive integer literal', 'regexp_extract requires a string literal as its first argument', 'regex parse error', 'out of valid range', '" does not exist', 'attempt to create relation with too many columns', 'target replica failed or was dropped', 'cannot materialize call to', 'arrays must not contain null values', 'OVER clause not allowed on', 'cannot reference pseudo type', 'window functions are not allowed in table function arguments', 'window functions are not allowed in OR argument', 'window functions are not allowed in AND argument', 'window functions are not allowed in aggregate function', 'invalid IANA Time Zone Database identifier', 'Top-level LIMIT must be a constant expression', 'LIMIT must not be negative', 'materialized view objects cannot depend on log sources', 'aggregate functions are not allowed in OR argument', 'aggregate functions are not allowed in AND argument', 'aggregate functions are not allowed in WHERE clause', 'aggregate functions are not allowed in table function arguments', 'aggregate functions are not allowed in LIMIT', 'nested aggregate functions are not allowed', 'function map_build(text list) does not exist', 'timestamp cannot be NaN', 'exceeded recursion limit of 2048', 'key cannot be null', 'regexp_extract must specify at least one capture group']