gopgext builds PostgreSQL extensions from Go with TinyGo
Original title: PostgreSQL Extensions in Go
The project is experimental and warns a bug in generated code can crash the server or corrupt data.
gopgext turns annotated Go functions into PostgreSQL SQL functions, generating C glue, an install script and a control file via TinyGo. It supports triggers, aggregates, index operator classes, foreign data wrappers and SPI queries, and ports of several contrib modules pass upstream regression tests. The author says it is experimental, the API may change, and generated code runs inside the server.
- A comment directive marks a Go function as a SQL function.
- Several Go extensions can load in one backend.
- PostgreSQL errors do not unwind through Go frames.
- A sibling project, gokm, builds Linux kernel modules from Go the same way.
From the original article
2 min read at jespino.github.io
gopgext builds PostgreSQL extensions from plain Go code, using TinyGo. Mark a function with //gopgext:function and it becomes a SQL function: gopgext writes the C glue, the install script and the control file. Experimental gopgext is experimental.
By valyala · jespino.github.io
A short excerpt; the article and its images belong to the publisher. Summary, key facts and assessment above are AI-written from the article and can be wrong.