Live data from Hacker News

Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

github.com

211–220 of 756 posts

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#211

Earlier quoted context omitted.

From what I skimmed manually, not that many, but the code itself seems labyrinthical. Like, why have both Rust Try-supporting Error-like tagged union, but also booleans, for error handling, in the same function? https://github.com/malisper/pgrust/blob/3646a73515a5e4ac7d0b... https://github.com/malisper/pgrust/blob/3646a73515a5e4ac7d0b...

I'm not sure what you mean? The rust code you're showing mimics the Postgres code: https://github.com/postgres/postgres/blob/2e6578292a9184dcaa... The boolean being returned is the return value of the function. It's not used to return an error.

Now that I have taken a closer look, the code looks significantly better than it seemed at first glance, though there are still peculiarities, and some drawbacks.

An unfortunate aspect is that the code has become a bit more bloated in some regards due to usage of Result, instead of an implicit elog() macro and similar. Passing Result around, in some ways as an alternative to an unwinding exception, is cleaner in some ways, but it also bloats the code somewhat.

The rewrite also could have simpler code in some cases, like

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

could perhaps just be

match syscache_seams::search_pg_class_full_form::call(ctx.mcx(), relationId)? {

        Some(form) => Ok(form.relhassubclass),

        None => {

            Err(ereport(ERROR)
                .errmsg(format!("cache lookup failed for relation {relationId}"))
                .into_error())

        }

    }
but that is a smaller thing.

I see a lot of MemoryContext. I am not sure how much that bloats the code (though the C code is bloated due to C's issues and problems, like re-using collections and such). Does it incur an overhead?

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#212
post #92
post #71

Earlier quoted context omitted.

LLMs learn a distribution during pre-training, not only an average. Then, by giving them context or by post-training, you can make them sample non-average parts of the distribution they learned.

> Then, by giving them context or by post-training, you can make them sample non-average parts of the distribution they learned. How do you derive that something is "below average" or "average" or "above average"?

>How do you derive that something is "below average" or "average" or "above average"?

How do you? I mean, that was your point basis.

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#213
post #123

Earlier quoted context omitted.

Yeah I'm using that one. We have a problem with software religious fundamentalists in our organisation and it's an apt description.

I actually had a lot of problems with software cult followers of influencer gurus like ThePrimeagen, Lex Fridman, Theo, etc... Those are so worst. You can't resonate with them.

Trick is to ignore people who follow the cult.

We went down the earlier Udi Dahan and DDD crap.

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#214

Earlier quoted context omitted.

Yeah same. The structure makes no real sense and when digging into the code it reads like I'm the first human to look at it.

I'm too young but I imagine assembly programmers were feeling the same when automatic code generation by compilers took over. Very weird.

I guess there also were macro-assemblers before C, so it was a bit more natural.

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#217
post #28
post #20

Earlier quoted context omitted.

When the software consists entirely of ~$1000 worth of Claude credits and ~40 hours of developer time prompting and curating it, literally what does it matter what license the resulting 100k LoC artifact is provided under? Copyleft and the whole software licensing ecosystem only matter when producing that software actually requires serious human effort and dedication.

Also can the code even be copyrighted? For my machine translation of SQLite to Go I added this to the README as to licencing: Most of the code here is machine translated using wasm2go. As such, the original authors retain copyright and the original licenses remain in effect. Everything else is licensed under MIT-0. The translator (wasm2go) has a licence chosen by, and a copyright notice from, me. Makes no sense for t…

I do the same for translated code. It's not creative work which is a prerequisite for being copyrightable.

And avoid relying on direct LLM output for actual work to make sure I don't accidentally include some regurgitated snippet from an incompatible license.

It helps that LLMs struggle to write good, idiomatic code in my language of choice.

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#218
post #196

Earlier quoted context omitted.

You must be replying to a different comment. Seems completely unrelated to what I wrote. I never claimed that there wasn't AI slop. My point is that there are different levels of code coming out of AI, both due to the quality of the model and harness, and the quality of the engineer that is driving it. Thus you can't just bucket all AI developed code the same. 100% there is slop created by humans and really solid cod…

I quote-replied to your comment, so I doubt it was unrelated. > I never claimed that there wasn't AI slop No, but you implied that a top tier dev doesn't produce slop when using AI. > If you have a black box that spits out code, and you are unable to distinguish the quality between a top tier dev and an AI inside the black box My point was that "if" is doing a lot of heavy lifting here and you're coming very close to…

Yes most people are not top tier devs and most code is slop whether written by AI or not. I've probably dug through tens of thousands of code bases in my over 30 year career as a software engineer and most are slop.

I also did not claim that all "top tier devs" would always produce better code with AI, but the qualification for a "top tier dev" in this case would be someone who verifies code multiple ways to make sure it is correct. I've seen amazing code come from bad interns that was reviewed mercilessly by season devs, and there's absolutely no reason it would not be the same with AI generated code.

You do realize that you can review the entire architecture and code line for line even if it's AI generated right? My black box comment did not mean you couldn't see the code, it meant you don't know whether a machine wrote it or not.

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#219
post #34
post #14

Earlier quoted context omitted.

> not mostly the test, but the real world production scars Most extensive test suites are exactly production scars: every time you have a bug or a regression, you write a test that confirms correct behaviour. SQLite is a good example to bring up because its extensive closed-source tests are what’s often cited as being what keeps people from forking it. (Turso did it, though, but it takes a company to deliver some gua…

Sure, but behaviors that never have a bug or regression don't get a test. Software of this kind of complexity has all kinds of behavior that has never been broken, and doesn't have a specific test written for it. Getting an extensive test suite passing is certainly orders of magnitude better than having no test suite at all, but it still doesn't tell you as much as you need to know. I would absolutely never trust an…

Perhaps before embarking on one of these rewrites the first step should be a heavy round of mutation testing and property based testing. Contribute any new testing code from this back to the original project. And *then* embark on the rewrite.

Re: Postgres rewritten in Rust, now passing 100% of the Postgres regression tests

#220
post #100

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?

will it only bring more "memory safety" or is there a serious performance gain as well? The project will die in a couple of days or weeks. You're making a mistake if you're seriously consider using this in any capacity.

As is every slop generated project. It’s the Toy Story meme irl.

https://knowyourmeme.com/memes/i-dont-want-to-play-with-you-...

Post reply on HN