Open-Source Wikis

/

PostgreSQL

/

Fun facts

postgres/postgres

Fun facts

A handful of trivia and oddities pulled from the PostgreSQL source tree.

The 30-year-old commit

git log --reverse shows the very first commit:

d31084e9d11  1996-07-09  Postgres95 1.01 Distribution - Virgin Sources

Every line of code in this repo descends from that import. Some of it — particularly in the catalog and rule subsystems — has scarcely been rewritten since.

"Virgin sources"

That commit message is one of the few that has acquired a kind of folk-historical status in the project. "Virgin sources" is what you get when you import a tarball without modifications. It dates the codebase like a tree ring.

The "xlog" vs "wal" naming compromise

PostgreSQL 10 renamed pg_xlog/ to pg_wal/ and pg_resetxlog to pg_resetwal because too many sysadmins, looking at a disk full of pg_xlog and assuming "log" meant "log file", deleted the directory and lost their database. The renaming was deliberately disruptive — but you'll still find xlog everywhere in the C code (xlogreader.c, xlogrecord.h, XLogRecPtr, XLogInsert) because renaming all of those would break every extension.

The grammar that ate the build

src/backend/parser/gram.y is the single biggest source file in the tree at roughly 18,000 lines. Bison's reaction to it is the longest single step in a clean build. The grammar covers every SQL statement PostgreSQL knows, plus every dialect quirk the project has been compatible with, all the way back to PostQUEL relics like transaction named savepoints.

The OID 0 myth

Object Identifiers (OIDs) are 32-bit integers assigned to every catalog row. By convention OID 0 is invalidInvalidOid — and code that accidentally uses it tends to crash quickly. This is treated almost as a lore-level invariant; Assert(OidIsValid(x)) shows up everywhere.

Two competing build systems, both supported

Most projects pick autoconf or Meson. PostgreSQL ships both. Every directory has a Makefile and a meson.build, kept in sync by hand. The Meson build was added relatively recently (committed as a parallel build, then promoted to recommended) and the autoconf build is being kept around for compatibility with downstream packagers and Windows MSVC scripts.

The longest-suffering function name

heap_multi_insert_v2 does not exist; the project sticks with heap_multi_insert and accepts that the function will grow another argument someday. PostgreSQL committers tend to refactor the call sites rather than version the names. There are exceptions — pg_logging_init, pg_logging_init_2 — but they are rare enough to be talked about.

"Tom said no"

A non-trivial fraction of pgsql-hackers patch threads conclude with a polite veto from Tom Lane, the project's most prolific committer (32,599 commits as of this snapshot — by some margin the largest contribution to any open-source database). The phrase "Tom said no" is not in the code, but it is part of the project's institutional memory.

The Berkeley DNA

Open any source file. The header reads:

Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
Portions Copyright (c) 1994, Regents of the University of California

That second line has been there since 1996 and will probably still be there in 2096. PostgreSQL pre-dates Linux's release as a stable kernel.

The TOAST acronym is not a backronym

"The Oversized Attribute Storage Technique" is the original expansion. The PostgreSQL community managed, on its first try, to get a useful acronym that also meant something normal in English. This is rarer than it sounds.

HEAD is a relative term

PostgreSQL's master branch was renamed from master to a different name not at all; the project still uses master as the development branch and is unlikely to change it. The mailing-list-driven workflow does not lean on GitHub branch defaults.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Fun facts – PostgreSQL wiki | Factory