147 comments

[ 4.6 ms ] story [ 105 ms ] thread
I feel like we need to heavily differentiate between a rewrite and an AI rewrite.
nope. any rewrite will be an AI rewrite soon.
I start to see a lot of these re-writes that depend on tests to state that its working. But the things that make software like Postgres and SQLite reliable are not mostly the test, but the real world production scars. That's where the reliability comes from, years and years of running in production.
Not weighing in on this specific rewrite but tests are how you specify that your software works correctly. If a behavior isn’t covered by an automated test in some form you can’t assert that any given change doesn’t break it.

I think it is completely reasonable to use a preexisting unmodified test suite to state that something is working. The larger the project the more true this becomes. Real world production scars are documented and guarded against in the test suite otherwise those lessons get lost.

Also SQLite is legendary for its massive test suite and extensive fuzzing. They have 590x the amount of test code and scripts than normal code. Source: https://sqlite.org/testing.html

Great point. Stated another way:

"Mom, can I have battle-tested, reliable software"

"We have battle-tested, reliable software at home"

Battle-tested, reliable software at home: (Pic of green text from `cargo test`)

> That's where the reliability comes from

So, we should make it easier to feed that reliability back upstream.

Probably the most useful thing you can do with these LLM-transpilations for now: If the transpiled version passes all original tests, I can run my application test suite against it and use it to discover test coverage deficiencies in the original!

If it crashes or otherwise observably misbehaves, I know the real project was missing regression tests for something. We could make upstream so much more resilient against accidentally breaking stuff in future updates, if only it becomes safe (offline + no side effects) and easy (if it crashes/locks, it is not from some memory safety bug from 25k transactions earlier) to run these transpiled projects as one row in our everyday integration matrix.

Woah! AGPL? That's interesting. I think Postgres has shown an open source SQL server didn't need a copy-left license to develop sustainably, so I'm not entirely aure about that, but I do like the license in general.
We had one for SQLite (which is SQL-ite btw, not SQ-Lite which doesn't make any sense) via Turso, no wonder we see the same for Postgres. Personally I do want to see libraries be in as much memory safe languages as possible.
Does it support the extension ecosystem? Or would extensions need to be rewritten as well?
They would need to be rewritten as there is no formal extension API. Extensions can call into almost any part of PostgreSQL.
I think we will actually see some successful projects coming out of this. There are definitely people who want x old project in this new/better programming language and who are willing to put effort into maintaining it not just doing one off port.
What would be interesting is if they found a memory unsafe bug. Postgres is a perfect case study of 30 years of C with a bit of CPP; if rewriting in a safer language didn't find anything...
C programmer have learned how to deal with memory problems and have whole suites of tools for finding them.

Is it cheaper to find them at compile time rather than runtime? Yes.

But it’s not an unsolved problem. Memory bugs are a known unknown.

The great Jarred Sumner pulled it off with bun, whether it can be pulled of with Postgres is an open question..

DST systems such as Antithesis can definitely help.

Now which one is safer? A new Postgres written in Rust, or the original real world tested Postgres?
What is the future of this? Code is not the same as a viable open-source project with a community, contributors, advocates, users and funding, even if it's perfect code.

Even though I'm sure it won't be easy to convince the Postgres project to switch to Rust, I do think that trying would be time better spent.

Why should a developer use this for anything beyond a pet project? Just because it is written in Rust?

All these "rewritten in rust" projects only reinforce the idea that a significant part of the rust community consists of software talibans and not of engineers who must deliver something that works and is reliable over time.

As someone who loves Rust the language and tool set: This class of projects [LLM rewrite of a reliable piece of software honed over decades) is embarrassing.

If you are watching this and haven't used rust: Please don't judge the language by this part of its users.

> All these "rewritten in rust" projects only reinforce the idea that a significant part of the rust community consists of software talibans and not of engineers who must deliver something that works and is reliable over time.

Nailed it ! There are some folks who behave holier-than-thou just because they happen to use some language. Language missionaries if you will, and they are insufferable.

I wonder how long this will be maintained for...
I am not trolling, but I have a simple question: Why? Why do I use this instead of the official build? What is the business case?
(I'm working with malisper on this), we are now focusing on improving many things about postgres! Some we have written about before [0], and we have much more in mind too. Malis wrote another comment about analytical workloads being 300x faster now than postgres for a version we're working on right now

Aiming for postgres compatible database with a 2026 architecture

[0] https://malisper.me/the-four-horsemen-behind-thousands-of-po...

Why not then doing it as a fork - using existing code and language to re-architect? What value does Rust bring here? You are using LLMs to rewrite, so the language is pretty much irrelevant from developers perspective.

You can say "we want it in Rust" and leave it there - I'd be fine with it. Wouldn't use it though.

Why not? The author have their own reasons to do it. Did they ask you to use it instead of the official build? It's a github repo.

Why does there need to be a business case? They aren't selling it.

There is big appetite for PostgreSQL in business cases. But there's also a lot of problems in PG and people want to solve them. But there's ~10 people in the core of PostgreSQL who contribute to it and know how to change the core. If you have a business use case that would require changing the core, doing it in safer, less error prone technology would be way better. That's why you have other products that had to be created that talk PG protocol, but aren't using official build.
Why so much negativity? I find these projects interesting for learning purposes and exploring new ways. What’s wrong with that?
Possibly:

1. Piggybacking established brand names (Postgres + Rust)

2. … without practicality nor advancement (e.g. this solves no extra problems)

3. … without trust (i.e. LLM-driven rewrite, with no capabilities to thoroughly review it)

I think people get easily upset when the title has high-signal names like Postgres, and the title touts it somehow, yet it’s obviously impractical for obvious reasons (short-/long-term practicality, social trust & network effect, etc)

Yeah, if the title was : Vibe coded SQL engine written in rust, I don't think much anger would be found in the comments.

But then its credibility would be abysmally low, which makes it undesirable for the authors.

Agreed, the negativity here is quite wild.

There are new power tools for our craft. People are experimenting and having fun with said power tools, and have interesting results that may be transferrable to $YOUR_PROJECT.

Doing things just because we can is a great reason for hacking around.

Kudos for the author for answering questions and keeping up resilience - HN crowd is not what it used to be (shakes fist at a different cloud).

Because it's a waste of token.

I'd love to be proven wrong, but chances are that nobody will use this in production, people will completely forget about the project in 6 months, and the project will be archived not long after that.

This is not the first one of similar projects.

What a peculiar kind of rewrite.

Rust:

https://github.com/malisper/pgrust/blob/3646a73515a5e4ac7d0b...

Original:

https://github.com/postgres/postgres/blob/df293aed46e3133df3...

Usage:

https://github.com/malisper/pgrust/blob/3646a73515a5e4ac7d0b...

The return type in the rewrite is both some sort of Error tagged union that supports the Try machinery in Rust; but, it also contains a boolean that apparently must be checked; or something. It seems labyrinthical and possibly broken and terrible.

Is this another llm-driven rewrite?

I wonder how many "unsafe" blocks are in there...

How is the performance compared to regular PostgreSQL?

I know it says it is not performance optimized yet, but if this succeeds, will it only bring more "memory safety" or is there a serious performance gain as well?

How would one go about reviewing a piece of code like this?

One of the things I'd typically do is peek at the commit history. Seeing what people worked on and how they did it tends to say a lot about a project. But with LLMs generating 7101 commits in less than a month that isn't feasible. Even looking at a single day is way too much [1]. It probably also doesn't make sense since the commits content won't tell you much anyway.

ps. How do you easily get to the first commit in a repo on GitHub? Browsing commit history feels rather tedious

[1] - https://github.com/malisper/pgrust/commits/main/?since=2026-...

(I'm working with malisper on pgrust),

I think the focus for projects like this is going to shift to reviewing the testing/fuzzing process instead of reviewing each commit (going much further than what the postgres regression/isolation/crash tests do).

related post from danluu: https://danluu.com/ai-coding/

You don’t. You trust that passing the regression tests means you are totally compatible with the original version.
In general (I’m not saying this is the case with this project) if you don’t have their prompt history and you can’t re-run the LLM “compilation” yourself, is it open source? It feels a bit more like those “source available” projects where you can read the code but don’t have access to the build system.

On the other hand, aside from the commit messages, one didn’t ever have access to the underlying thought process of human developers either, so maybe it’s not equivalent to say that secret prompts mean closed-source.

I started by looking at the dependencies.

Then I lost count, so I ran wc -l Cargo.lock

   1467 Cargo.lock
Easily over a thousand dependencies. And "rewritten in Rust" is supposed to be a good thing? I bet this doesn't even compile faster than the original.
> One of the things I'd typically do is peek at the commit history. Seeing what people worked on and how they did it tends to say a lot about a project

I could not care less about any of this. Truth is code, as it is now. I don't care when (and certainly not by who) a bug got introduced, it's here, shut up and fix it.

I'm starting to get a bit of fatigue for these projects that boil down to just "I asked Claude to re-write this code into a new language that's in vogue right now!"

I really don't understand why this is needed outside of an opportunity to show how impressive LLMs can be when working within large codebases, but even then people in the comments are finding bizarre implementation choices that a human developer wouldn't make. I'll stick with Postgres and its - gasp - C implementation for now, thanks.

In this case it's justified because Rust allows safe implementation of threaded code. Current Postgres is per-process. Switching to threading yields performance improvements.
Rewrites in Rust are kinda impressive. This language with its move semantics and close ownership tracking is very different from every other language. To create a rewrite in it, you have to rearchitect the code. There is not as much freedom there when it comes to where to keep what and where you can pass what as it is in other languages.
> The goal is to make Postgres easier to change from the inside

uh-huh, sure.

you want to show off "look what the LLM can do / look what I burned a bunch of tokens on"?

you want to brag about how your LLM-generated slop is somehow more maintainable than the original because blah blah blah Rust?

here [0] is the version history of Postgres. pick a version from the past. let's say 14.x because it's the most current that's still under active support.

have your LLM implement version parity with 14.x. show off how it passes all the tests blah blah blah.

then have it upgrade your codebase to parity with 15.x, implementing whatever new features and bugfixes that includes.

and have it generate an automated test that demonstrates upgrading an actual database from LLM-14.x to LLM-15.x and verifying there's no data loss or corruption. maybe even multiple such tests, if you're feeling fancy.

then lather, rinse and repeat with 16, 17, and 18.

and show off the diffs of each version. does the LLM rewrite a huge pile of already-working code in the process of each version upgrade? does it introduce new latent bugs in the process - the kind of things the existing test suite didn't think to explicitly test for?

"I took a static snapshot of code and converted it to another static snapshot of code" is meaningless. all you're doing is bragging about having more money than good sense.

the stability and trustworthiness of software like Postgres does not come from a one-time snapshot showing tests passing. it comes from the engineering process that produces the software and its test suite.

oh, and for shits and giggles, because this same test was so illuminating with the Bun "rewrite" into Rust, here is the file with the most unsafe blocks in the codebase:

    > rg -c unsafe crates/backend/parser/gram_core/src/convert_ddl.rs
    128
    > wc -l crates/backend/parser/gram_core/src/convert_ddl.rs
    2055 crates/backend/parser/gram_core/src/convert_ddl.rs
why does a single 2000-line file have over 100 unsafe blocks?

why is the parser unsafe at all?!?

0: https://en.wikipedia.org/wiki/PostgreSQL#Release_history

This is actually a great point I have not seen articulated. A motivation for clear architecture and good design is being able to evolve the system over time. Does LLM code have that capacity? Are LLMs themselves able to increment iteratively?
Neat as a pet project, but anyone thinking of using this is production is insane.

Rewriten in Rust is becoming a meme now.

Been a meme for a while now. I avoid that noise on principle.
Now do Freetype and libtiff/libpng/etc.

I have privately wondered for years, pre-AI, why Apple hadn’t paid some engineers to go off and write some comprehensive test suites and then port these to Swift. It would shut down entire swaths of memory safety bugs they have been coping with for literally decades. SO MANY of the zeroclick iOS exploits can be traced to a few fragile and vulnerable foss libraries, xkcd 2347 style.

Rust and its ecosystem needs to become more original. There are so many new problems that needs software solutions. Existing solutions that already work don't have to be rewritten in Rust.
A lot of it is actually GPL-washing and rust is the excuse.

I'm on the rewrite it in rust bandwagon, but I secretly want to rewrite things in rust so they can be refactored and made easier to maintain and add features. So "rewrite it in rust" is just like "rewriting it in anything that I'm currently enamored with," and doing it with an LLM (defactoring?) would miss the point for me.

rust being safe(r) just makes the rewrite less risky.