在成为父母后,大型语言模型(LLM)帮助我维护了 PRQL 的 PostgreSQL 扩展。

3作者: kaspermarstal7 个月前
孩子们,围坐过来,听我讲个故事。让我来告诉你们,人工智能是如何从我的孩子们手中拯救我的开源项目的。<p>很久很久以前,有一个开源开发者,他维护着一个用于 PRQL 的 PostgreSQL 扩展,在 Github 上拥有数百颗闪耀的星星,他拥有着他想要的一切。但后来,一个美丽的女人走进了他的生活,并以她的爱来回报他的奉献。开发者被她的美貌迷住了,毫不犹豫地接受了,并直接陷入了其中,因为她揭示了她礼物的真正本质:两个小混蛋——呃,孩子——他们会夺走他所有的时间,让他无法再使用电脑。<p>我们的故事开始于一个关键依赖项发布了一个破坏性变更 [1],导致该扩展无法支持 PostgreSQL 17。但唉,维护者没有时间进行软件工程。“别怕,女朋友!”维护者说道,“我会用代码来解决这个问题!”。他召唤了 Claude Code,用英语敲击键盘,因为他把钱都花在了 Claude 的 Max 计划上。<p>他劳作了三个晚上:第一个晚上取得了真正的进展,模型成功地弄清楚了如何通过 pgrx::RetAbi 返回 pgrx::Datum。在第二个晚上,模型无法将其发现推广到 pgrx::TableIterator 和 pgrx::SetOfIterator,因为列类型在编译时是未知的。在第三个晚上,女朋友说“振作起来,帮我照顾孩子”,并且分支 pgrx-v0.12.9 [2] 逐渐淡出了人们的视野。<p>随着季节更迭,PostgreSQL 18 发布,用户们越来越失望,因为他们从“FROM”而不是“SELECT”开始的对关系数据的顺序转换仍然停留在 PostgreSQL 16 上。开发者对他的被遗弃的仓库感到羞愧,他将失败进行了隔离,因为他怎么才能在有两个小孩的情况下学会维护开源项目呢?<p>事实证明,答案是等待更好的模型。当 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/ 上的链接感到难过,该链接将成千上万的访问者导向了他的仓库。<p>在我们的故事结束之前,维护者要求模型进行某些质量改进。在几次“你绝对正确!”和一些惊人的错误之后,他意识到一些美学必须由人工来完成。因此,他在提交 82dbc44 [4] 和 d61d04ad [5] 中进行了手动重构,推送了 v18.0.1 [6],并从此过上了幸福的生活。当你有 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
查看原文
Gather around kids, it&#x27;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. &quot;Fear not girlfriend!&quot;, said the maintainer, &quot;For I will vibe code a fix!&quot;. And he summoned Claude Code and touched his keyboard in english places, for he had spent their coin on Claude&#x27;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 &quot;get your shit together and help me with the kids&quot; 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 &quot;FROM&quot; and not with &quot;SELECT&quot; 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:&#x2F;&#x2F;github.com&#x2F;postgres&#x2F;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:&#x2F;&#x2F;prql-lang.org&#x2F; 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 &quot;You are absolutely right!&quot; 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:&#x2F;&#x2F;github.com&#x2F;pgcentralfoundation&#x2F;pgrx&#x2F;pull&#x2F;1701 [2] https:&#x2F;&#x2F;github.com&#x2F;kaspermarstal&#x2F;plprql&#x2F;compare&#x2F;main...pgrx-v0.12.9 [3] https:&#x2F;&#x2F;github.com&#x2F;kaspermarstal&#x2F;plprql&#x2F;releases&#x2F;tag&#x2F;v18.0.0 [4] https:&#x2F;&#x2F;github.com&#x2F;kaspermarstal&#x2F;plprql&#x2F;commit&#x2F;82dbc44808871f60d0cc42b65124faf56f387db4 [5] https:&#x2F;&#x2F;github.com&#x2F;kaspermarstal&#x2F;plprql&#x2F;commit&#x2F;d61d04ad735765ef87f4f67d57ecaf0da27aad51 [6] https:&#x2F;&#x2F;github.com&#x2F;kaspermarstal&#x2F;plprql&#x2F;releases&#x2F;tag&#x2F;v18.0.1