Documentation

Everything about building PostgreSQL extensions in Go with gopgext.

gopgext builds PostgreSQL extensions from plain Go code, using TinyGo. A project is just Go files: functions marked with //gopgext:function become SQL functions, and gopgext supplies everything else: the C glue, the CREATE FUNCTION script and the control file. Go’s standard library works (fmt, strings, regexp, encoding/json, crypto/*, maps, generics, defer/recover, iterators…), and Go code can run queries through SPI.

Warning

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.

Start here#

  • Installation: requirements and installing the gopgext command.
  • Tutorial: a “hello world” extension in ten minutes.

Guides#

Reference#

License#

gopgext is released under the MIT License. The contrib ports derive from PostgreSQL’s contrib modules and also keep the PostgreSQL License.