# gopgext lets you write PostgreSQL extensions in pure Go

Original title: PostgreSQL Extensions in Go

> Hacker News story 50591260 · language: en · submitted 2026-11-21
> Web version: https://zeli.app/story/50591260
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 165 · by [valyala](<https://news.ycombinator.com/user?id=valyala>) · 💬 32
[original](<https://jespino.github.io/gopgext/>) · [HN discussion](<https://news.ycombinator.com/item?id=50591260>)

## Summary

gopgext compiles plain Go code into PostgreSQL extensions using TinyGo, automatically generating the C glue, install script, and control file. Functions marked with //gopgext:function become SQL functions, with full standard library support and direct type mapping. Ports of contrib modules like pgcrypto and hstore pass upstream regression tests. It's experimental and unsafe for production, but it handles triggers, aggregates, index access methods, and foreign data wrappers.

## Key quote

> Experimental gopgext is experimental. Don’t use it in production: a bug in the generated code or the Go runtime runs inside the server, where it can crash it or corrupt data, and the API and generated SQL may change without notice.

## HN discussion (32 comments)

### [3eb7988a1663](<https://news.ycombinator.com/item?id=50592016>)

> The Go community sold me on the necessity of programming mascots. The gopher is adorable, and I love seeing the creative tweaks for how people incorporate it into their marketing.
>
> Ferris the crab also seems like it has been around since the early days, but I do not see nearly as many projects with crab heavy media. Guess it also has to be a mammal.

### [QGQBGdeZREunxLe](<https://news.ycombinator.com/item?id=50592937>)

> From the same author: https://jespino.github.io/gokm/ (Linux kernel modules in Go)

### [philippemnoel](<https://news.ycombinator.com/item?id=50595652>)

> More people using and extending Postgres is a huge win for the ecosystem, but I am somewhat uncertain of the appeal of Go for this task. It seems to really shine at "platform"-level tasks (e.g. K8s, network proxies, etc. etc.), while Postgres extensions are more at the data plane level.

### [septune](<https://news.ycombinator.com/item?id=50601974>)

> Does it support Go's goroutines ?

### [WanderZil](<https://news.ycombinator.com/item?id=50599217>)

> Nice that errors reported by Go are raised only after Go returns, avoiding a `longjmp` through Go stack frames.

---

## Cite

- Page: https://zeli.app/story/50591260
- Date: 2026-11-21
- Source: jespino.github.io (https://jespino.github.io/gopgext/)
- Hacker News: https://news.ycombinator.com/item?id=50591260

## Other languages

- zh: https://zeli.app/zh/story/50591260 · markdown: https://zeli.app/zh/story/50591260.md
- ja: https://zeli.app/ja/story/50591260 · markdown: https://zeli.app/ja/story/50591260.md
- ko: https://zeli.app/ko/story/50591260 · markdown: https://zeli.app/ko/story/50591260.md
- de: https://zeli.app/de/story/50591260 · markdown: https://zeli.app/de/story/50591260.md
- es: https://zeli.app/es/story/50591260 · markdown: https://zeli.app/es/story/50591260.md
- ru: https://zeli.app/ru/story/50591260 · markdown: https://zeli.app/ru/story/50591260.md
