Repository navigation
test(postgres): cover derived tables over schema-qualified tables - #63
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I reviewed the regression tests for the settle step's RefCell already borrowed panic, which #53 fixed. I also checked that the new unit test fails without that fix.
- Engine unit test:
a_derived_table_or_a_with_query_over_a_schema_qualified_table_is_settleduses a fake host whoseRELATION_COLUMNS_QUERYanswers onlyusersand whoseATTNOTNULL_QUERYanswers by oid. It checks type and nullability for a derived table and a WITH query overapp.accountsand overusers. The test passes one5e04ef. I removed thedrop(known)/ re-borrow arounditem_columnsin my local checkout, and it then failed withRefCell already borrowedatpostgres.rs:686, so it catches the bug. - Oracle statements:
schema_qualified.sqlandwith_schema_qualified.sqlreadpublic.barthrough a derived table and a WITH query. Their blessed lines (id: int8, score: int4, both non-null) matchsetup.sql, whereidis the primary key andscoreisnot null. - Artifact:
packages/postgres/engine.wasmis rebuilt because the source fingerprint covers the test module. The other two artifacts are unchanged, as expected.
claude-opus-5-5 | 𝕏
A derived table or WITH query over a table the catalog's rows by name do not match panicked with "RefCell already borrowed" until the settle step let go of its borrow. Only the artifact's source fingerprint changes: the test module is part of the hashed source.
colinhacks
force-pushed
the
postgres-test-host-borrow
branch
from
October 23, 2026 05:38
e5e04ef to
b9e0fca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds regression tests for a panic in the Postgres engine's settle step: it held the relations map borrowed (
known) whileitem_columnsprobed a derived table's or WITH query's statement, and a probe that fetched a relation's catalog rows tookrelations.borrow_mut()inprefetch, which panicked with "RefCell already borrowed". This happens when the catalog's by-name rows don't match a relation the inner statement reads. A schema-qualified table does this: the parse names itpublic.barand the catalog matchesrelname. #53 landed the fix itself (drop(known)beforeitem_columns, borrowed again after it). This PR adds the tests that pin it down.Before #53, against a live Postgres 18:
After:
What it adds:
oracle/cases/derived_tables/schema_qualified.sqlandwith_schema_qualified.sql, blessed and checked against seeded rows.engine/postgres/src/postgres.rs,a_derived_table_or_a_with_query_over_a_schema_qualified_table_is_settled. Its fake host answers the catalog's by-name rows forusersonly, andNOT NULLby oid. The test asserts each column's type and nullability for a derived table and a WITH query, overapp.accountsand overusers. With the borrow held, it fails with the panic above.Only tests change, and engine behaviour does not.
packages/postgres/engine.wasmis rebuilt only because its source fingerprint hashes the whole crate source, test module included. The SQLite and MySQL artifacts are unchanged.Verified:
cargo-build,engine-tests,oracle-tests,wasm,oracle(109 cases, 0 failed),typecheck,loader-tests(222 passed, 0 skipped) andpackageall pass on the rebased branch.