mirror of
https://github.com/allankoechke/turso.git
synced 2026-11-30 11:12:58 +00:00
`make -C postgres/conformance run-postgres` runs the corpus with the postgres backend. It uses the server at PG_DSN. If PG_DSN is not set, with-postgres.sh starts a throwaway PostgreSQL container with Docker and gives it a role that has CREATEDB and is not a superuser. A new CI job, "Run SQL tests (PostgreSQL)", runs the target. The container keeps its data on tmpfs and runs with fsync, synchronous_commit, full_page_writes, autovacuum and JIT off, and with wal_level=minimal. These settings do not change query results. The target runs two tests per CPU, because a test often waits for the server. With the LATERAL tests of #9468, 848 tests take about 6 s on 4 CPUs, against about 60 s with the default settings. The PostgreSQL version is one line in with-postgres.sh, and POSTGRES_VERSION changes it for one run. The image comes from mirror.gcr.io, because Docker Hub limits the pull rate of anonymous clients. 40 of the 187 tests failed on PostgreSQL 17. They check Turso-specific behavior: the EXPLAIN output, the catalogs that Turso keeps empty, and the error for a write to a catalog table. Three of them fail because Turso has the ACLs of PostgreSQL 16, without the MAINTAIN privilege of PostgreSQL 17. Mark them with @skip-if postgres, with a reason that tells what PostgreSQL does. Tests: make -C postgres/conformance run-postgres, which failed 40 tests before the skips; make -C postgres/conformance run Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R3hzXhfjBgyLPUF7vd3PHW
93 lines
1.8 KiB
Plaintext
93 lines
1.8 KiB
Plaintext
# EXPLAIN through the PostgreSQL frontend.
|
|
#
|
|
# Simple EXPLAIN is intentionally mapped to SQLite's EXPLAIN QUERY PLAN.
|
|
# PostgreSQL EXPLAIN options are rejected until their output semantics exist.
|
|
|
|
@skip-file-if postgres "EXPLAIN shows the Turso query plan, and Turso rejects EXPLAIN options that PostgreSQL accepts"
|
|
|
|
@database :memory:
|
|
|
|
setup explain_table {
|
|
CREATE TABLE t (id int);
|
|
INSERT INTO t VALUES (1), (2);
|
|
}
|
|
|
|
setup dml_items {
|
|
CREATE TABLE items (id int primary key, value int);
|
|
INSERT INTO items VALUES (1, 10);
|
|
}
|
|
|
|
@setup explain_table
|
|
test explain-select {
|
|
EXPLAIN SELECT id FROM t WHERE id = 1;
|
|
}
|
|
expect {
|
|
1|0|0|SCAN t
|
|
}
|
|
|
|
@setup dml_items
|
|
test explain-insert-does-not-execute {
|
|
EXPLAIN INSERT INTO items VALUES (2, 20);
|
|
SELECT id, value FROM items;
|
|
}
|
|
expect {
|
|
1|10
|
|
}
|
|
|
|
@setup dml_items
|
|
test explain-update-does-not-execute {
|
|
EXPLAIN UPDATE items SET value = 99 WHERE id = 1;
|
|
SELECT id, value FROM items;
|
|
}
|
|
expect {
|
|
2|0|0|SEARCH items USING INTEGER PRIMARY KEY (rowid=?)
|
|
1|10
|
|
}
|
|
|
|
@setup dml_items
|
|
test explain-delete-does-not-execute {
|
|
EXPLAIN DELETE FROM items WHERE id = 1;
|
|
SELECT id, value FROM items;
|
|
}
|
|
expect {
|
|
2|0|0|SEARCH items USING INTEGER PRIMARY KEY (rowid=?)
|
|
1|10
|
|
}
|
|
|
|
test explain-result {
|
|
EXPLAIN SELECT 1;
|
|
}
|
|
expect {
|
|
1|0|0|SCAN CONSTANT ROW
|
|
}
|
|
|
|
test explain-analyze-errors {
|
|
EXPLAIN ANALYZE SELECT 1;
|
|
}
|
|
expect error {}
|
|
|
|
test explain-options-error {
|
|
EXPLAIN (VERBOSE) SELECT 1;
|
|
}
|
|
expect error {}
|
|
|
|
test explain-verbose-errors {
|
|
EXPLAIN VERBOSE SELECT 1;
|
|
}
|
|
expect error {}
|
|
|
|
test explain-costs-off-errors {
|
|
EXPLAIN (COSTS OFF) SELECT 1;
|
|
}
|
|
expect error {}
|
|
|
|
test explain-buffers-errors {
|
|
EXPLAIN (BUFFERS) SELECT 1;
|
|
}
|
|
expect error {}
|
|
|
|
test explain-format-json-errors {
|
|
EXPLAIN (FORMAT JSON) SELECT 1;
|
|
}
|
|
expect error {}
|