No, there is no publicly verified instance of a full PostgreSQL rewrite in Rust by AI that passes 100% of PostgreSQL’s regression tests. While several projects are actively rewriting PostgreSQL components or building Rust-based Postgres-compatible databases, none has publicly demonstrated complete regression test parity. This article explains the landscape, the challenges, and what “passing the regression tests” actually means in this context.
What the Regression Tests Cover
PostgreSQL’s regression tests are a suite of over 200 test scripts (thousands of individual assertions) that exercise SQL syntax, data types, indexing, transactions, concurrency, and hundreds of edge cases. They are the de facto standard for verifying that a database behaves like PostgreSQL. Passing them means your engine produces identical results for these queries, including error messages and row ordering (unless explicitly allowed).
However, the regression tests are not exhaustive. They do not cover performance, replication, backup/restore, or many advanced features like logical decoding. So even a 100% pass is a strong compatibility signal, not a proof of full feature parity.
Why Rewrite PostgreSQL in Rust?
Rust offers memory safety without garbage collection, which is attractive for database internals that manage large caches and concurrent access. Projects like pg_lite, pg_analytics, and Supabase’s Wrappers are using Rust for extensions or specific subsystems. Full rewrites, such as Materialize (which uses Rust for a streaming SQL engine) and RisingWave, are inspired by PostgreSQL but are not drop-in replacements.
The motivation is usually:
- Memory safety – avoid buffer overflows and use-after-free bugs common in C.
- Concurrency – Rust’s ownership model simplifies safe parallel execution.
- Developer productivity – modern tooling and package management.
How the AI Rewrite Process Would Work
If an AI were to rewrite PostgreSQL in Rust, it would likely follow this pattern:
- Parse the C source – extract function signatures, data structures, and control flow.
- Generate Rust equivalents – using a model trained on code, produce idiomatic Rust with similar logic.
- Manually adapt – handle memory management, pointer arithmetic, and C-specific idioms.
- Run the regression tests – compile and execute the test suite, fixing failures iteratively.
This is a massive undertaking. The PostgreSQL codebase is over 1.5 million lines of C. Even with AI assistance, the generated code must be reviewed and debugged by humans. Currently, no AI system can autonomously produce a fully working, production-grade database engine.
Current Rust-Based PostgreSQL Projects
Several projects are closer to a full rewrite than others:
- pg_light – a minimal Postgres-compatible layer that supports basic queries but is far from full regression parity.
- Steampipe – uses Postgres wire protocol but is not a rewrite; it’s an API-to-SQL bridge.
- Neon – uses Rust for its storage engine but relies on the actual PostgreSQL for SQL processing.
None of these claim to pass the entire regression suite. The closest to a full rewrite is pg_snake (a hobby project) and PGRX (a framework for writing extensions in Rust, not a rewrite).
Challenges in Achieving Regression Test Parity
Even with AI, several obstacles make 100% parity extremely difficult:
- Undefined behavior – C code relies on implementation-defined behavior that Rust may handle differently.
- Error message exactness – tests compare output text; minor wording differences cause failures.
- Catalog and system columns – internal system tables and functions must match exactly.
- Concurrency semantics – MVCC and locking behavior are subtle and hard to replicate.
- Extension API – many tests assume C hooks that Rust cannot directly provide.
In practice, projects often aim for “compatible with common queries” rather than full regression parity.
How to Verify a Claim of Passing Tests
If you encounter a claim that a Rust rewrite passes 100% of PostgreSQL regression tests, verify:
- Which version of PostgreSQL? – The tests change with each release.
- Did they run the full suite? – Some projects run only a subset.
- Did they modify the tests? – Removing failing tests or relaxing output matching invalidates the claim.
- Is the code public? – Reproducibility is key.
As of now, no such public project exists.
Frequently Asked Questions
Can AI rewrite PostgreSQL in Rust automatically?
No. AI can generate code snippets, but a full rewrite requires human oversight for correctness, security, and performance. Current AI models lack the deep understanding needed for a complex system like PostgreSQL.
What does “passing 100 tests” mean?
It likely means 100 individual test scripts, not 100%. The full suite has over 200 scripts. A project that passes 100 scripts has made significant progress but is still far from full compatibility.
Is there a Rust database that fully replaces PostgreSQL?
No. Some databases like CockroachDB and YugabyteDB use PostgreSQL wire protocol but have their own storage engines. They do not pass all PostgreSQL regression tests.
Why not just use PostgreSQL with Rust extensions?
That is a practical approach. Using Rust for extensions gives memory safety where it matters most, while leveraging the mature, battle-tested core. This is what many production systems do.
What are the risks of using a Rust rewrite in production?
Compatibility gaps, performance regressions, and lack of community support. Even if regression tests pass, edge cases and advanced features may behave differently.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Flash Converter: What It Is & How to Use It
- Choosing a Pipe Flow Meter for Swirling Flow
- Motorola Phone Recovery: How to Recover Data
- Poco X3 GT Dimensity 1100 67W Fast Charging Launched?5.00 min/km
- Convert 2D Videos to Oculus Rift VR: How-To
- DRAM Light on Motherboard: Meaning & Fixes5.00 min/km