Discussion summary

A new Postgres implementation rewritten in Rust now passes all regression tests, raising questions about safety, licensing, and ecosystem support.

What the discussion says

  • Some see it as a safer, Rust-based alternative to traditional Postgres.
  • Concerns about extension support and ecosystem compatibility.
  • Debate over licensing, with mentions of AGPL and open-source sustainability.
  • Uncertainty about its future viability as a community-driven project.
Now passing 100% of the Postgres regression tests.
satvikpendem
Would extensions need rewriting? Yes, they would.
mebcitto

Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • 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?
  • It's pure virtue signaling.
  • Software raidership?
  • 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 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.

  • Because Rust is what's cool these days. Don't you wanna be cool? Also Rust has memory safety things that C++ doesn't have, so there's a class of bugs that can't happen in the Rust version. That doesn't mean the Rust version is 100% bug free, but just that it's not vulnerable to that class of bugs. So it's a good thing for security reasons if you're running a database server somewhere that attackers could get at it. There might be performance benefits down the road if they choose to focus on that.
  • (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...

  • I think a business case for a "look I let an LLM rewrite a large codebase" does not exist.
  • Regression tests start to play a different role with LLMs.

    On one hand, they give an LLM a short feedback loop to correct itself, and iterate fast when writing code. A human also uses it as a feedback loop, but we don't iterate as fast and don't handle big walls of conditions, so its effect is not as big.

    On the other hand, LLM's ability to handle a big wall of if-conditions can backfire if it starts taking shortcuts and taking the tests-as-a-spec too literally, overfitting the solution, overly focusing on the given datapoints (conditions checked by tests) and missing the overall behavior shape that the tests intend to pin down. For humans, this is less of a concern because we are bad at big walls of if-conditions, and we'd rather try to see the original shape that the tests are pinning down than monkey-patch the solution to fit the individual points.

    It's interesting to see how one balanced these two. In this case particularly. Maybe you could play around with separating the data you give an LLM into "training set" and "validation set", training set can be seen fully, but validation set is hidden and is only queried when the solution is deemed ready. Say, training set = original source code + half of the tests; LLM uses that for quick feedback loop. And validation set = the remaining half of the tests; test code is not shown to the LLM and run only when the LLM says it's done to catch potential overfitting of the resulting solution over training set.

    To me, the credibility of a solution like that would depend on what methodology the authors used. If they just let the LLM see all tests, I'd be skeptical (albeit unable to point out specific bugs due to the volume of work and LLM's ability to make bad things look trustworthy). The good thing is, real-life use will add new, unseen before datapoints for testing — so validation set will build up with time. Really curious to see how it will work.

  • Property testing and deterministic simulation seem like good alternatives.
  • Why so much negativity? I find these projects interesting for learning purposes and exploring new ways. What’s wrong with that?
  • People feel threatened by LLMs doing things well that they feel should require their skills and talent.

    That's understandable but it's still a bit of a negative emotion that probably isn't very productive. Or very rational. This thread is full of people trying to argue that this can't be any good, shouldn't be any good, and is clearly going to end in tears. And obviously this thing passing tens of thousands of carefully curated tests that accumulated over decades suggests otherwise. It's hard to argue against that.

    This probably is going to have some new issues. But it's an impressive achievement.

  • 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.

  • I don't really understand how "written by AI" and "for learning purposes" can ever be compatible. What exactly does one learn from typing "Rewrite this in Rust, make no mistakes" into a terminal?
  • I am concerned about the quality. Even a cursory skim of the code makes the code appear asinine. Unless the genius aspects of the code elude me.

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

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

  • 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).

  • can you enlighten me, what exactly do you learn from asking a llm to do a rewrite?
  • Because it’s uncomfortable to see decades of work copied so trivially.
  • 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)

  • If you can do a Rust rewrite with AI, I can create one as well. What makes yours better than mine? Your decade long expertise in database or Rust language? Your reputation? Your proven track record to manage large, complex projects? Your time committed to the project? I don't see any of that.

    I don't know why anyone would choose this over the actively (community) maintained proper Postgres project.

  • > If you can do a Rust rewrite with AI, I can create one as well.

    Translations are a lot more likely to be error-free and robust, as the original data structures and algorithms have been battle tested.

  • Came here to the same thing. I did something similar (but bolder, it doesn't slavishly copy Postgres and is based on current DB research papers and the like, and other bits I've been exposed to over the years). It has a full TPC-C-esque benchmark suite, replication, embedded v8/JavaScript relations/stored procedures, a giant suite of regression tests, it kicks the crap out of a lot of existing OLTP DB stuff out there. And I personally do have a background in commercial DB development.

    But I choose not to publish it or promote it for many of the reasons you mention above (and more)

    ... For one, if "I" can do it, so can a hundred other people. And all the bold claims behind it would need to be backed up and supported and it promoted, etc, which is a whole pile of time that doesn't involve writing code.

    It's the organization around a project that matters, not the code. It's not the 90s anymore w/ people piling into MySQL because it was the only option. People aren't going to be trusting your software with their data, if they can't trust you.

    And unless someone is going to dump a pile of money or something on [me|them], I don't have the ability to build that organization ... as I need to feed my family... Nor am I willing to put my personal reputation on the line by putting up a huge quickly written application and then someone finding something in it I can't explain.

    So like probably 500 other projects I have it sitting in a private repo.

    It's a very weird time right now. "Technical" excellence isn't the important part. Organizational excellence is. This was always the case but it's more so now.

    ... In the meantime, if anybody has angel investment to burn, I have something potentially better/more-exciting than this guy's project but... see above...

  • There’s no claim being made that your rewrite cannot be better.

    He has provided benchmark results which provide a dimension amongst which to measure your rewrite. If you can do better by all means post your rewrite.

    Finally, these kind of projects can eventually over time become projects that are actively used. Postgres is not some entity that existed before the universe was created; it was also created by someone and then eventually adoption picked up over time.

  • Just keep using the proper Postgres project if it makes more sense to you. But notice that this isn't just a strict translation, it actually makes changes (moving from process to thread based design, for instance). Time will tell if people find these changes beneficial or if the original remains preferable.

    It's also worth noting, that while you are able to use LLM's to produce your own translation, he's actually done it. There's value in actually putting in the work.

    This isn't a unique situation at all. Many Postgres extensions are developed and maintained by a single person, and may therefore be avoided by more conservative users, even if they offer some technical advantages. To each, their own.

  • His project is cool. Students could use it as an example of porting code. Companies could switch to it, if it works. There are hundreds of reasons why people may want it, so it's awesome he's publishing one. Something needs to be done to get interest and then adoption.
  • 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.
  • As sibling mentioned - bugs and regressions are the thing that are (in a perfect world) usually covered.

    The problem however is non-covered success cases. A visualisation of the problem: let's say universe of interaction for DB consists of 10.000 SQL queries. Over 10 years various regressions were found and 2.000 SQL queries are guarded by tests. In reference implementation remaining 8.000 never surfaced over this time and it's unclear if they will work.

    And, thinking of how many various SQL queries PostgreSQL users around the world are using vs the test cases covered it's obvious that feature space isn't covered in 1% of the success ratio cases.

    Now the new, test-based implementation, has to prove it can handle remaining 99%.

    by xlii
  • > 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.

  • Completely agree with this.

    The biggest lie of software engineering is that everything can be testable with tests. That a 100% test coverage is an indicator of quality software.

  • 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`)