postgres/postgres
PostgreSQL
PostgreSQL is an open-source object-relational database management system. It implements a large subset of SQL plus extensions for transactions, foreign keys, triggers, user-defined types, stored procedures, and many others. The codebase is a 1.4M-line C project that has been under continuous development since 1996, when the team forked from Postgres95 at UC Berkeley.
This wiki documents the source tree at https://github.com/postgres/postgres. It is aimed at engineers who want to understand how the server works internally, contribute patches, or build tools that integrate with the C codebase.
What's in the box
A PostgreSQL source checkout produces several distinct artifacts:
- The server (
postgres) — the main backend executable. Thepostmasteris justpostgresinvoked in a particular mode; it forks one backend per client connection plus assorted background workers (autovacuum, WAL writer, checkpointer, etc.). - Frontend tools — command-line utilities like
psql,pg_dump,pg_basebackup,pg_upgrade, andinitdb. These live undersrc/bin/. - Client libraries —
libpq(the C client driver) andecpg(embedded SQL preprocessor), undersrc/interfaces/. - Procedural languages — PL/pgSQL, PL/Perl, PL/Python, PL/Tcl, under
src/pl/. - Contrib modules — optional extensions that ship with the server (postgis is not one of them — these are first-party only). See
contrib/.
How to read this wiki
If you are new, start with Architecture for the 30,000-foot view, then Getting started to actually build and run the server. The Glossary collects domain terms (WAL, MVCC, OID, snapshot, etc.) that you will see everywhere.
For day-to-day contribution mechanics — branches, mailing lists, patch format, the commitfest — see How to contribute.
The bulk of the wiki is organized under Systems, which walks the major backend subsystems: storage, access methods, MVCC, the query pipeline (parser → planner → executor), the catalog, replication, and the postmaster process model. Frontend tools are documented under Apps, client libraries under Interfaces, and PLs/contrib under Extensions.
Tech and conventions
- Language: C (C99). A small amount of Perl for code generation (e.g.
genbki.pl), and SQL/PL test scripts. - Build: Both an autoconf-based GNU make build (
./configure && make) and a Meson build (meson setup build && ninja -C build). The two are kept in sync; new files must be added to both. - Style: Unix-style C, tabs for indentation, BSD-flavored brace placement.
pgindent(insrc/tools/pgindent) is the canonical formatter — it is run on the tree before each release. - License: PostgreSQL License (a permissive 2-clause-BSD-style license). See
COPYRIGHT.
Project status
PostgreSQL releases a new major version once a year in the autumn. Development happens on master; bug-fix backpatches go to the five most recent supported branches (REL_NN_STABLE). The mailing list pgsql-hackers is the canonical forum for design and review.
The code in this checkout corresponds to the master branch at commit 3dd42ee97b8. See By the numbers for repo statistics and Lore for a historical narrative.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.