大型语言模型让我在成为父母后仍能维护我的 PostgreSQL 扩展 PRQL。
孩子们,过来吧,故事时间到了。让我给你们讲讲人工智能如何拯救我的开源项目,拯救我免于孩子们的“折磨”。
从前,有一位开源开发者,他维护着一个用于PRQL的PostgreSQL扩展,在Github上拥有数百颗闪亮的星星,他拥有一切他心中所愿。但不久,一位美丽的女士走进了他的生活,向他表达了爱意,作为回报,她希望得到他的奉献。被她的美貌所吸引,开发者毫不犹豫地接受了她的爱,结果她揭示了她礼物的真实本质:两个小家伙——呃,孩子——将会占据他所有的时间,让他无法再专注于电脑。
我们的故事开始于一个关键依赖项发布了一个破坏性更改[1],这使得该扩展无法支持PostgreSQL 17。然而,维护者却没有时间进行软件工程。“别担心,女朋友!”,维护者说道,“我会快速编码修复!”于是他召唤了Claude Code,开始在键盘上敲击,毕竟他已经为Claude的Max Plan花费了他们的资金。
他连续奋斗了三个晚上:第一个晚上取得了真正的进展,模型成功地找到了如何通过pgrx::RetAbi返回pgrx::Datum。第二个晚上,模型却无法将其发现推广到pgrx::TableIterator和pgrx::SetOfIterator,因为列类型在编译时是未知的。到了第三个晚上,女朋友说:“整理好你的事情,帮我照顾孩子!”于是,分支pgrx-v0.12.9[2]逐渐被遗忘。
随着季节的变迁,PostgreSQL 18发布了,用户们对他们的关系数据的顺序转换感到失望,因为这些转换以“FROM”开头,而不是“SELECT”。开发者因自己被遗弃的代码库而感到羞愧,他将失败封闭在心中,毕竟他怎么能在有两个小孩的情况下学习维护开源项目呢?
答案,结果是,等待更好的模型。当Anthropic发布Claude Sonnet 4.5时,维护者再次尝试。他的眼睛睁大了,Claude Code克隆了https://github.com/postgres/postgres,并像在前世一样检查PostgreSQL的内部结构。在WebSearch的帮助下,以及一套在GPT 3.5之前就已编写的全面测试套件的支持下,模型找到了返回pg_sys::Datums、SetOf记录,甚至HeapTuples的方法。凭借对测试的信任,维护者迅速发布了v18.0.0[3],不再对https://prql-lang.org/上的链接感到内疚,因为这个链接为他的代码库带来了成千上万的访问者。
在我们的故事结束之前,维护者向模型请求了一些质量改进。在经历了几次“你说得对!”和一些惊人的失误后,他意识到某些美学必须由人类之手来完成。因此,他在提交82dbc44[4]和d61d04ad[5]中进行了手动重构,推送了v18.0.1[6],并过上了幸福的生活。谁还需要时间呢,当你有Claude Sonnet 4.5的时候?
[1] https://github.com/pgcentralfoundation/pgrx/pull/1701
[2] https://github.com/kaspermarstal/plprql/compare/main...pgrx-v0.12.9
[3] https://github.com/kaspermarstal/plprql/releases/tag/v18.0.0
[4] https://github.com/kaspermarstal/plprql/commit/82dbc44808871f60d0cc42b65124faf56f387db4
[5] https://github.com/kaspermarstal/plprql/commit/d61d04ad735765ef87f4f67d57ecaf0da27aad51
[6] https://github.com/kaspermarstal/plprql/releases/tag/v18.0.1
查看原文
Gather around kids, it's storytime. Let me tell you about the time AI saved my open source project from my children.<p>Once upon a time there was an open source developer who maintained a PostgreSQL extension for PRQL with hundreds of sparkling stars on Github and he had everything his heart desired. But then, a beautiful woman came into his life and offered him her love in return for his devotion. Enchanted by her looks, the developer accepts without hesitation and walks right into it as she reveals the true nature of her gift: two little shits - errh, kids - who will go on to take all his time away from his computer.<p>Our story began when a critical dependency shipped a breaking change [1] that prevented the extension from supporting PostgreSQL 17. But alas, the maintainer had no time for software engineering. "Fear not girlfriend!", said the maintainer, "For I will vibe code a fix!". And he summoned Claude Code and touched his keyboard in english places, for he had spent their coin on Claude's Max Plan.<p>For three nights he labored: The first night brought real progress and the model successfully figured out how to return pgrx::Datum via pgrx::RetAbi. On the second night, the model could not generalize its findings to pgrx::TableIterator and pgrx::SetOfIterator because column types were unknown at compile time. On the third night, the girlfriend said "get your shit together and help me with the kids" and branch pgrx-v0.12.9 [2] faded into obscurity.<p>As seasons passed and PostgreSQL 18 was released, users grew disillusioned for their sequential transformations of relational data that starts with "FROM" and not with "SELECT" were stuck in PostgreSQL 16. Ashamed of his abandoned repo the developer compartmentalized his failure, for how could he ever learn to maintain open source projects with two small kids?<p>The answer, as it turned out, was to wait for better models. When Anthropic released Claude Sonnet 4.5, the maintainer tried again. His eyes widened as Claude Code cloned https://github.com/postgres/postgres and inspected PostgreSQL internals exactly as he would have done in a previous life. With the help of WebSearch and a comprehensive test suite that was well understood because it was written before GPT 3.5, the model figured out how to return pg_sys::Datums, SetOf records, and even HeapTuples. By the power of his trust in the tests, the maintainer quickly released v18.0.0 [3] and no longer felt bad about the link on https://prql-lang.org/ that sent thousands of visitors to his repository.<p>Before our story ends, the maintainer asked the model for certain quality improvements. After a couple of "You are absolutely right!" and spectacular fuckups, he realized some aesthetics must be wrought by human hands. And so he made manual refactorings in commits 82dbc44 [4] and d61d04ad [5], pushed v18.0.1 [6], and lived happily ever after. Who needs time when you have Claude Sonnet 4.5?<p>[1] https://github.com/pgcentralfoundation/pgrx/pull/1701
[2] https://github.com/kaspermarstal/plprql/compare/main...pgrx-v0.12.9
[3] https://github.com/kaspermarstal/plprql/releases/tag/v18.0.0
[4] https://github.com/kaspermarstal/plprql/commit/82dbc44808871f60d0cc42b65124faf56f387db4
[5] https://github.com/kaspermarstal/plprql/commit/d61d04ad735765ef87f4f67d57ecaf0da27aad51
[6] https://github.com/kaspermarstal/plprql/releases/tag/v18.0.1