---
title: "Adding PostgreSQL 15 support to Neon Storage using Rust"
description: "Neon's Rust storage engine parses Postgres WAL and data pages through bindgen-generated FFI bindings."
url: "https://swe.quest/articles/adding-postgresql-15-support-to-neon-storage-using-rust-ef91ab1acfe56ae8"
canonical: "https://neon.com/blog/how-we-added-support-for-postgresql-v15-in-neon"
source: "Neon"
published: "2022-11-09"
difficulty: "medium"
kind: "How-to"
reading_minutes: 4
tags: ["rust","postgres","c-cpp","build-systems"]
---

# Adding PostgreSQL 15 support to Neon Storage using Rust

A post on [Neon](https://swe.quest/sources/neon.md), published 2022-11-09, 4 min read, How-to. Original: [https://neon.com/blog/how-we-added-support-for-postgresql-v15-in-neon](https://neon.com/blog/how-we-added-support-for-postgresql-v15-in-neon)

## Summary

Neon's Rust storage engine parses Postgres WAL and data pages through bindgen-generated FFI bindings. To support PostgreSQL 14 and 15 side by side, build.rs runs bindgen once per version against that version's server headers, producing separate bindings files. A macro then wraps each set into versioned submodules (v14, v15). Public functions dispatch on a pg\_version parameter, and version-independent types are re-exported, so the rest of the codebase changes very little and code isn't duplicated.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [C & C++](https://swe.quest/tags/c-cpp.md) (Languages)
- [Build systems](https://swe.quest/tags/build-systems.md) (Engineering practices)

## Prerequisites

- Rust build scripts ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))
- Rust FFI ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))
- Rust macros ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))

## Keywords

Neon, bindgen, PostgreSQL 15, WAL, postgres\_ffi

## Related posts

- [We're building Postgres in Rust. Using the LLVM of databases](https://swe.quest/articles/we-re-building-postgres-in-rust-using-the-llvm-of-databases-e44d34208278a99e.md): Turso · 2026-07-16 · Easy · 11 min read · PostgreSQL, SQLite, Rust, Query engines, Open source
  Turso, a Rust rewrite of SQLite, is adding a Postgres frontend by parsing Postgres SQL into a common AST and compiling it to Turso's VDBE bytecode, turning the engine into an "LLVM of databases" with pluggable frontends.
- [Supabase is now on Postgres 13.3](https://swe.quest/articles/supabase-is-now-on-postgres-13-3-2931acd8ef3ece75.md): Supabase · 2021-07-26 · Easy · 3 min read · PostgreSQL, Performance engineering
  New Supabase projects now run Postgres 13.3 (up from 12.0), bringing native gen\_random\_uuid, parallel index vacuuming, incremental sorting and smaller B-tree indexes.
- [Postgres Foreign Data Wrappers with Wasm](https://swe.quest/articles/postgres-foreign-data-wrappers-with-wasm-121e854eab291417.md): Supabase · 2024-08-16 · Medium · 5 min read · PostgreSQL, WebAssembly, Rust, Sandboxing & isolation
  Supabase Wrappers, a Rust framework for building Postgres Foreign Data Wrappers, now supports WebAssembly FDWs that are downloaded from URLs like GitHub or S3, checksum-verified, cached and run in a sandboxed Wasm runtime inside the Postgres extension.
- [Postgres WASM by Snaplet and Supabase](https://swe.quest/articles/postgres-wasm-by-snaplet-and-supabase-a942df855beab1df.md): Supabase · 2022-10-03 · Medium · 9 min read · PostgreSQL, WebAssembly, Virtualization, Browsers, Networking
  postgres-wasm runs a full PostgreSQL 14 server in the browser by emulating an x86 machine with v86 rather than compiling Postgres to WASM directly.
- [How we scale an open source, multi-tenant storage engine for Postgres written in Rust](https://swe.quest/articles/how-we-scale-an-open-source-multi-tenant-storage-engine-for-postgres-written-in-e5615307ced50afc.md): Neon · 2024-04-15 · Medium · 5 min read · Storage engines, PostgreSQL, Distributed databases, Multi-tenancy, Scaling
  Neon shards its Rust-based Pageserver storage layer by dividing each Postgres relation's 8KiB block numbers into stripes (default 256MiB) and hashing each stripe to a Pageserver.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
