{"slug": "postgres-rewritten-in-rust-now-passing-100-of-the-postgres-regression-tests", "title": "Postgres rewritten in Rust, now passing 100% of the Postgres regression tests", "summary": "A Rust rewrite of PostgreSQL called pgrust now passes 100% of PostgreSQL 18.3's regression tests, matching expected output across more than 46,000 queries. The project aims to make PostgreSQL easier to modify internally while maintaining disk compatibility and using AI-assisted programming. It is not yet production-ready or performance-optimized.", "body_md": "**A Postgres rewrite in Rust.**\n\npgrust targets compatibility with Postgres 18.3 and matches Postgres's expected output across more than 46,000 regression queries.\n\npgrust is disk compatible with Postgres and can boot from an existing Postgres 18.3 data directory.\n\nThe goal is to make Postgres easier to change from the inside: keep the behavior Postgres-shaped, keep the real Postgres tests as the oracle, and use Rust plus AI-assisted programming to explore deeper server changes.\n\npgrust is not production-ready yet. It is not performance optimized yet.\n\nExisting Postgres extensions and procedural language extensions such as PL/Python, PL/Perl, and PL/Tcl are not generally compatible yet. Some bundled contrib modules are already ported, and more compatibility may be possible over time.\n\n- multithreaded Postgres internals\n- built-in connection pooling\n- better JSON-heavy workload support\n- fast forking and branching workflows\n- storage experiments, including no-vacuum designs\n- runtime guardrails for bad queries and AI-generated SQL\n- fewer sudden bad plan switches\n\nTry the WebAssembly demo at [https://pgrust.com](https://pgrust.com).\n\nDocker:\n\n```\ndocker run -d --name pgrust -e POSTGRES_PASSWORD=secret malisper/pgrust:v0.1 && until docker exec -e PGPASSWORD=secret pgrust psql -h 127.0.0.1 -U postgres -c '\\q' >/dev/null 2>&1; do sleep 1; done && docker exec -it -e PGPASSWORD=secret pgrust psql -h 127.0.0.1 -U postgres; docker rm -f pgrust\n```\n\nThis uses the `psql`\n\nclient inside the Docker image.\n\n`malisper/pgrust:latest`\n\ncurrently points at the same release, but `v0.1`\n\nis the\npinned launch image.\n\nmacOS:\n\n```\nbrew install icu4c openssl@3 libpq\n\nexport LIBRARY_PATH=\"$(brew --prefix openssl@3)/lib:${LIBRARY_PATH:-}\"\nexport PKG_CONFIG_PATH=\"$(brew --prefix openssl@3)/lib/pkgconfig:$(brew --prefix icu4c)/lib/pkgconfig:${PKG_CONFIG_PATH:-}\"\nexport PATH=\"$(brew --prefix libpq)/bin:$PATH\"\n```\n\nDebian/Ubuntu:\n\n```\nsudo apt-get update\nsudo apt-get install -y build-essential pkg-config libicu-dev libssl-dev libldap2-dev libpam0g-dev postgresql-client-18\n```\n\nBuild:\n\n```\nPGRUST_PGSHAREDIR=\"$PWD/vendor/postgres-18.3/share\" \\\ncargo build --release --locked --bin postgres\n```\n\nCreate a data directory:\n\n```\ntarget/release/postgres --initdb \\\n  -D /tmp/pgrust-data \\\n  -L \"$PWD/vendor/postgres-18.3/share\" \\\n  --no-locale \\\n  --encoding UTF8 \\\n  -U postgres\n```\n\nRun pgrust:\n\n```\nulimit -s 65520\n\nRUST_MIN_STACK=33554432 target/release/postgres \\\n  -D /tmp/pgrust-data \\\n  -F \\\n  -c listen_addresses= \\\n  -k /tmp \\\n  -p 5432 \\\n  -c io_method=sync \\\n  -c max_stack_depth=60000\n```\n\nConnect:\n\n```\npsql -h /tmp -p 5432 -U postgres -d postgres \\\n  -c \"select version(), 1 + 1 as two\"\n```\n\nRun the Postgres regression tests against pgrust:\n\n```\nPGRUST_BIN=\"$PWD/target/release/postgres\" \\\nscripts/run-regression\n```\n\nThe runner uses pgrust's own `--initdb`\n\nplus the vendored Postgres 18.3 test\nfiles in this repository. It needs a Postgres 18 `psql`\n\nclient on `PATH`\n\n; if\n`psql`\n\nis somewhere else, set `PGRUST_PSQL=/path/to/psql`\n\n.\n\nVerified launch result: pgrust matched Postgres's expected output across more than 46,000 regression queries.\n\nThis repository now contains the newer pgrust implementation that reached the regression-test milestone.\n\nThe older public implementation is archived on\n`archive/pre-fabled-2026-06-23`\n\n.\n\nBackground:\n\n- Original pgrust launch:\n[https://malisper.me/pgrust-rebuilding-postgres-in-rust-with-ai/](https://malisper.me/pgrust-rebuilding-postgres-in-rust-with-ai/) - 67% regression update:\n[https://malisper.me/pgrust-update-at-67-postgres-compatibility-and-accelerating/](https://malisper.me/pgrust-update-at-67-postgres-compatibility-and-accelerating/) - Four Horsemen roadmap:\n[https://malisper.me/the-four-horsemen-behind-thousands-of-postgres-outages/](https://malisper.me/the-four-horsemen-behind-thousands-of-postgres-outages/)\n\nPlease open an issue if something breaks, if setup is confusing, or if there is a Postgres improvement you want to see first.\n\n- Email:\n[maintainers@pgrust.com](mailto:maintainers@pgrust.com) - Discord:\n[https://discord.gg/FZZ4dbdvwU](https://discord.gg/FZZ4dbdvwU) - Mailing list:\n[https://malisper.me/subscribe/](https://malisper.me/subscribe/)\n\npgrust is licensed under AGPL-3.0. See `LICENSE`\n\n.", "url": "https://wpnews.pro/news/postgres-rewritten-in-rust-now-passing-100-of-the-postgres-regression-tests", "canonical_source": "https://github.com/malisper/pgrust", "published_at": "2026-07-09 06:18:19+00:00", "updated_at": "2026-07-09 06:42:26.189899+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools"], "entities": ["pgrust", "PostgreSQL", "Rust", "Postgres 18.3"], "alternates": {"html": "https://wpnews.pro/news/postgres-rewritten-in-rust-now-passing-100-of-the-postgres-regression-tests", "markdown": "https://wpnews.pro/news/postgres-rewritten-in-rust-now-passing-100-of-the-postgres-regression-tests.md", "text": "https://wpnews.pro/news/postgres-rewritten-in-rust-now-passing-100-of-the-postgres-regression-tests.txt", "jsonld": "https://wpnews.pro/news/postgres-rewritten-in-rust-now-passing-100-of-the-postgres-regression-tests.jsonld"}}