### Build SQLsmith on Debian Source: https://github.com/anse1/sqlsmith/blob/master/README.org Install dependencies and build SQLsmith on Debian. Run these commands in order from the sqlsmith source directory. The autoreconf step is only needed when building from a git checkout, not from a release tarball. ```shell apt-get install build-essential autoconf autoconf-archive libpqxx-dev libboost-regex-dev libsqlite3-dev ``` ```shell cd sqlsmith ``` ```shell autoreconf -i # Avoid when building from a release tarball ``` ```shell ./configure ``` ```shell make ``` -------------------------------- ### Build SQLsmith on macOS with Homebrew Source: https://github.com/anse1/sqlsmith/blob/master/README.org Install dependencies and build SQLsmith on macOS using Homebrew. Run these commands in order from the sqlsmith source directory. The autoreconf step is only needed when building from a git checkout, not from a release tarball. ```shell brew install libpqxx automake libtool autoconf autoconf-archive pkg-config ``` ```shell cd sqlsmith ``` ```shell autoreconf -i # Avoid when building from a release tarball ``` ```shell ./configure ``` ```shell make ``` -------------------------------- ### Run SQLsmith against PostgreSQL, SQLite, and MonetDB Source: https://github.com/anse1/sqlsmith/blob/master/README.org Example invocations of SQLsmith for each supported database. Each command connects to the target database, retrieves its schema, and generates random queries that are rolled back. Use an underprivileged user because SQLsmith may call functions with side effects like pg_terminate_backend. ```shell # testing Postgres sqlsmith --verbose --target="host=/tmp port=65432 dbname=regression" ``` ```shell # testing SQLite sqlsmith --verbose --sqlite="file:$HOME/.mozilla/firefox/places.sqlite?mode=ro" ``` ```shell # testing MonetDB sqlsmith --verbose --monetdb="mapi:monetdb://localhost:50000/smith" ``` -------------------------------- ### EXPLAIN output showing planner context for pg_get_indexdef Source: https://github.com/anse1/sqlsmith/blob/master/README.org The query plan output showing how the planner places pg_get_indexdef(oid) in a context where it sees non-index-oids, causing the cache lookup failure. ```text QUERY PLAN ------------------------------------------------------------------------------------ Hash Join (cost=17.60..30.65 rows=9 width=4) Hash Cond: (i.oid = x.indexrelid) -> Seq Scan on pg_class i (cost=0.00..12.52 rows=114 width=8) Filter: ((pg_get_indexdef(oid) IS NOT NULL) AND (relkind = 'i'::"char")) -> Hash (cost=17.31..17.31 rows=23 width=4) -> Hash Join (cost=12.52..17.31 rows=23 width=4) Hash Cond: (x.indrelid = c.oid) -> Seq Scan on pg_index x (cost=0.00..4.13 rows=113 width=8) -> Hash (cost=11.76..11.76 rows=61 width=8) -> Seq Scan on pg_class c (cost=0.00..11.76 rows=61 width=8) Filter: (relkind = ANY ('{r,m}'::"char"[])) ``` -------------------------------- ### SQLsmith output: query statistics and error summary Source: https://github.com/anse1/sqlsmith/blob/master/README.org Output from SQLsmith showing query generation/execution rates, AST stats, and a breakdown of errors encountered, with an overall error rate. ```text : queries: 39000 (202.399 gen/s, 298.942 exec/s) : AST stats (avg): height = 5.599 nodes = 37.8489 : 82 ERROR: invalid regular expression: quantifier operand invalid : 70 ERROR: canceling statement due to statement timeout : 44 ERROR: operator does not exist: point = point : 27 ERROR: operator does not exist: xml = xml : 22 ERROR: cannot compare arrays of different element types : 11 ERROR: could not determine which collation to use for string comparison : 5 ERROR: invalid regular expression: nfa has too many states : 4 ERROR: cache lookup failed for index 2619 : 4 ERROR: invalid regular expression: brackets [] not balanced : 3 ERROR: operator does not exist: polygon = polygon : 2 ERROR: invalid regular expression: parentheses () not balanced : 1 ERROR: invalid regular expression: invalid character range : error rate: 0.00705128 ``` -------------------------------- ### psql error output for cache lookup failure Source: https://github.com/anse1/sqlsmith/blob/master/README.org The error message output by psql when running the query that triggers the cache lookup failure. ```text FEHLER: cache lookup failed for index 2619 ``` -------------------------------- ### psql query triggering cache lookup failure Source: https://github.com/anse1/sqlsmith/blob/master/README.org A psql command that queries pg_catalog.pg_indexes and triggers the 'cache lookup failed for index 2619' error, as described in the README. ```sql self=# select indexdef from pg_catalog.pg_indexes where indexdef is not NULL; ```