postgres/postgres
Tooling
The src/tools/ and src/test/ directories carry a small army of helpers used by committers and contributors. This page lists the ones you'll actually run.
Code formatting
pgindent
The project's canonical formatter. Source: src/tools/pgindent/.
src/tools/pgindent/pgindent <files...>
src/tools/pgindent/pgindent --indent=/path/to/pg_bsd_indent # custom indent binarypgindent wraps a vendored fork of BSD indent, with a project typedef list (src/tools/pgindent/typedefs.list) so it correctly aligns project-defined types. New typedefs require an update to typedefs.list; src/tools/find_typedef extracts them from a built binary.
perltidy
Perl files (TAP tests, build helpers) are formatted by perltidy. The configuration lives at src/tools/pgindent/perltidyrc.
perltidy --profile=src/tools/pgindent/perltidyrc <files...>Verifying clean style
src/tools/pgindent/pgindent . # indent everything
git diff --check # whitespace errorsThe buildfarm reports style violations; CI catches most of them.
Code generation
PostgreSQL generates a non-trivial amount of C from data files. The generators live in the source tree and are invoked by the build system; you usually don't need to run them by hand, but it helps to know they exist.
| Generator | Source | Output |
|---|---|---|
genbki.pl |
src/backend/catalog/genbki.pl |
postgres.bki, pg_proc_d.h, schemapg.h, etc. — the bootstrap data and catalog C definitions. Reads pg_*.dat. |
Gen_fmgrtab.pl |
src/backend/utils/Gen_fmgrtab.pl |
fmgroids.h, fmgrtab.c — function manager dispatch tables. |
gen_node_support.pl |
src/backend/nodes/gen_node_support.pl |
copyfuncs.funcs.c, equalfuncs.funcs.c, outfuncs.funcs.c, readfuncs.funcs.c — Node tree support functions, generated from annotated headers. |
generate-errcodes.pl |
src/backend/utils/generate-errcodes.pl |
errcodes.h, plerrcodes.h, pllua_errcodes.h, etc. Reads errcodes.txt. |
gen_keywordlist.pl |
src/tools/gen_keywordlist.pl |
Keyword tables for the parser and psql. |
unicode_*.pl |
src/common/unicode/ |
Generated Unicode tables (case mappings, normalization). |
Touching pg_proc.dat or parsenodes.h triggers a regeneration on the next build.
Build systems
PostgreSQL supports two build systems in parallel.
Autoconf / GNU make
./configure [flags]
make -j$(nproc)
make install
make checkConfigure flags are documented at ./configure --help. The whole build is driven by GNUmakefile.in, src/Makefile.global.in, and per-directory Makefiles.
Meson
meson setup build [-Doption=value ...]
ninja -C build
meson install -C build
meson test -C buildPer-directory meson.build files mirror the Makefiles. The top-level options live in meson_options.txt.
When adding a new C file, add it to both the Makefile (OBJS = ...) and the meson.build (backend_sources_list += ... or the equivalent). The two builds are kept in sync by hand and by CI.
MSVC
Windows builds historically used a Perl-based MSVC build system (src/tools/msvc/). The Meson build is now the recommended path on Windows; the Perl scripts are being phased out.
Test runners
| Runner | Source | What it drives |
|---|---|---|
pg_regress |
src/test/regress/pg_regress.c |
Core SQL regression tests. |
pg_isolation_regress |
src/test/isolation/ |
Concurrency tests. |
prove (Perl) + PostgreSQL::Test::* |
src/test/perl/ |
TAP tests. |
make check, make installcheck, and make check-world glue them together. See Testing.
Profiling and analysis tools
The tree includes a few specialized helpers:
src/tools/check_keywords.pl— checks that the SQL keyword list inkwlist.hmatches the bison grammar.src/tools/find_static— finds static functions that aren't called and could be removed.src/tools/copyright.pl— bumps the copyright year across the tree.src/tools/check_bison_recursion.pl— sanity checks for stack-eating bison rules.src/tools/RELEASE_CHANGESandsrc/tools/version_stamp.pl— release engineering.src/tools/git_changelog— assembles the changelog fromgit logoutput.
DTrace probes
src/backend/utils/probes.d defines static DTrace probes (statement-start, statement-end, lwlock-acquire, etc.) used on Solaris, FreeBSD, and Linux (via systemtap). They are compiled in when --enable-dtrace is passed.
CI: Cirrus
The project runs CI on Cirrus CI. Configuration:
.cirrus.yml— global config..cirrus.tasks.yml— per-task definitions for Linux, FreeBSD, macOS, Windows, code style..cirrus.star— Starlark glue.
The same scripts run locally if you have the cirrus CLI tool, but most contributors rely on the upstream CI to catch cross-platform issues at patch time.
The buildfarm
A separate, project-administered farm of build machines runs PostgreSQL across many platforms and configurations and reports failures back. It is not in this repository — see https://buildfarm.postgresql.org/. It is the project's safety net against platform-specific regressions; new committers learn the buildfarm's coverage quickly when their first commit breaks AIX or Solaris.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.