• Sources: primary, discussion
  • Summary: gopgext turns Go functions marked with a //gopgext:function comment into SQL functions, generating the C glue, install script and control file and building with PGXS. Beyond functions it supports triggers, aggregates, GiST, GIN, SP-GiST and BRIN operator classes, index access methods, foreign data wrappers and hooks, and ports of pgcrypto, hstore, pg_stat_statements and cube pass upstream regression tests. The author marks it experimental and warns against production use, since a bug runs inside the server.
  • Why it matters: It offers a Go path for PostgreSQL extension work that has so far meant C or Rust with pgrx, though it is not yet safe for production servers.
  • Background: PostgreSQL extensions are shared libraries loaded into each backend process, so they share memory and error handling with the server. PostgreSQL reports errors with longjmp, which must not unwind through another language's stack frames. gopgext says it keeps those errors out of Go frames and copies results into PostgreSQL memory.
  • Comments: The Hacker News thread drew 98 points and 11 comments.