Skip to main content

Module 14: Contributing to PostgreSQL

PostgreSQL is one of the most welcoming open-source projects. This module guides you through the contribution process, from finding issues to getting your first patch committed.
Estimated Time: 8-10 hours
Difficulty: Expert
Prerequisite: Module 13 (Source Code)
Outcome: First accepted contribution

14.1 PostgreSQL Community Structure

┌─────────────────────────────────────────────────────────────────────────────┐
│                 POSTGRESQL COMMUNITY STRUCTURE                               │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│   CORE TEAM (5-7 members)                                                   │
│   └── Oversees project direction, final authority                          │
│                                                                              │
│   COMMITTERS (~25 members)                                                  │
│   └── Can commit code, handle specific areas                               │
│                                                                              │
│   MAJOR CONTRIBUTORS                                                        │
│   └── Regular significant contributions                                     │
│                                                                              │
│   CONTRIBUTORS                                                               │
│   └── Anyone who contributes patches, docs, testing       ◄── YOU START   │
│                                                                              │
│   Communication Channels:                                                    │
│   ┌─────────────────────────────────────────────────────────────────────┐   │
│   │ pgsql-hackers   │ Main development discussions                      │   │
│   │ pgsql-general   │ User questions                                    │   │
│   │ pgsql-bugs      │ Bug reports                                       │   │
│   │ pgsql-docs      │ Documentation                                     │   │
│   │ pgsql-advocacy  │ Marketing and promotion                           │   │
│   └─────────────────────────────────────────────────────────────────────┘   │
│                                                                              │
│   Infrastructure:                                                            │
│   • Git: git.postgresql.org                                                 │
│   • Mailing lists: lists.postgresql.org                                     │
│   • Bug tracker: bugs.postgresql.org                                        │
│   • Commitfest: commitfest.postgresql.org                                   │
│   • Wiki: wiki.postgresql.org                                               │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

14.2 Types of Contributions

Documentation

Easiest entry point
  • Fix typos and unclear explanations
  • Add examples to function documentation
  • Translate to other languages
  • Write tutorials and how-to guides

Bug Reports

Valuable contribution
  • Report bugs with minimal reproducible examples
  • Verify and triage existing bug reports
  • Test patches from others
  • Write regression tests for bugs

Code Patches

Core contribution
  • Bug fixes
  • Performance improvements
  • New features
  • Code cleanup and refactoring

Review

Highly valued
  • Review patches in Commitfest
  • Test patches for correctness
  • Provide constructive feedback
  • Help with code archeology

14.3 Finding Your First Contribution

Documentation Fixes

# Clone documentation
git clone https://git.postgresql.org/git/postgresql.git
cd postgresql/doc

# Find documentation issues
grep -r "TODO" src/sgml/
grep -r "FIXME" src/sgml/

# Check for unclear function docs
# Look at src/sgml/func.sgml

# Build and review docs
cd doc/src/sgml
make html
# View in browser

Good First Issues

# Find TODO comments in source
grep -r "TODO" src/backend/ | head -50
grep -r "FIXME" src/backend/
grep -r "XXX" src/backend/  # Needs attention

# Example findings:
# src/backend/commands/tablecmds.c:/* TODO: check for pending triggers */
# src/backend/optimizer/path/allpaths.c:/* XXX: consider partitionwise join */
Check: https://www.postgresql.org/list/pgsql-bugs/

Look for:
• Bugs with minimal reproducers
• Issues in areas you understand
• Bugs that have been confirmed but not fixed
• Old bugs that might have been fixed in recent commits
Check: https://commitfest.postgresql.org/

Filter by:
• Status: "Needs Review"
• Author: Anyone (avoid your own)
• Target: Current or next release

Even reviewing and testing counts as contribution!
# Find untested code paths
./configure --enable-coverage
make check
make coverage-html

# Look for red (uncovered) lines in:
# htmlcov/src/backend/*/index.html

# Write tests for uncovered edge cases

14.4 Development Workflow

Step 1: Set Up Mailing List

1. Go to https://lists.postgresql.org/
2. Subscribe to pgsql-hackers (for patches)
3. Subscribe to pgsql-general (for context)
4. Read archives to understand culture and expectations
5. Lurk for a few weeks before posting

Step 2: Create Your Patch

# Start from latest master
git checkout master
git pull origin master

# Create feature branch
git checkout -b my-feature

# Make your changes
vim src/backend/commands/myfile.c

# Commit with good message
git commit -m "Add feature X to command Y

This patch adds support for X when using command Y.
Previously, users had to manually do Z, which was error-prone.

Discussion: https://postgr.es/m/MESSAGE-ID"

# Generate patch
git format-patch master --stdout > my-feature.patch

Step 3: Test Thoroughly

# Full regression test
make check

# Specific tests
make check TESTS="select insert update"

# Isolation tests (for concurrency)
make check -C src/test/isolation

# Your new tests
make check TESTS="my-new-test"

# Different configurations
./configure --enable-cassert
make check

# Different platforms (if possible)
# Test on Linux, macOS, Windows

14.5 Patch Submission

Email Format

To: [email protected]
Subject: [PATCH] Add feature X to command Y

Hi hackers,

Attached is a patch that adds support for X when using command Y.

== Background ==

Currently, when users want to do Z, they need to manually perform 
steps A, B, and C. This is error-prone because [reasons].

== Solution ==

This patch adds a new option '--foo' to the Y command that 
automatically handles Z.

== Usage Example ==

  $ pg_dump --foo mydb > backup.sql

== Compatibility ==

This patch is backward compatible. Existing scripts continue to work.

== Testing ==

- Added regression tests in src/test/regress/sql/pg_dump.sql
- Tested on Linux x86_64 with PostgreSQL master
- make check passes

== Open Questions ==

1. Should --foo be the default in v18?
2. Is the error message clear enough?

Please review!

-- 
Your Name

[Attach: v1-0001-Add-feature-X-to-command-Y.patch]

Commitfest Registration

1. Go to https://commitfest.postgresql.org/
2. Click "Add Entry"
3. Fill in:
   - Name: "Add feature X to command Y"
   - Topics: Choose relevant area
   - Authors: Your name and email
   - Reviewers: Leave empty (others will pick up)
   - Thread URL: Link to your pgsql-hackers email
4. Submit and wait for review

14.6 Responding to Feedback

Common Review Comments

Reviewer says: “Please follow pgindent style”
# Run pgindent on your file
src/tools/pgindent/pgindent src/backend/commands/myfile.c

# Common issues:
# - Tabs vs spaces (use tabs)
# - Line length (< 80 chars)
# - Brace style (K&R for functions)
# - Comment style (/* ... */ not //)

Updating Your Patch

# Make requested changes
vim src/backend/commands/myfile.c

# Commit as new version
git add -A
git commit --amend  # Or new commit if complex

# Generate new patch version
git format-patch master --stdout > v2-my-feature.patch

# Reply to thread with new version

14.7 Patch Lifecycle

┌─────────────────────────────────────────────────────────────────────────────┐
│                         PATCH LIFECYCLE                                      │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│   SUBMITTED ──▶ NEEDS REVIEW ──▶ WAITING ON AUTHOR ──▶ READY FOR COMMITTER │
│        │              │                 │                      │            │
│        │              ▼                 ▼                      ▼            │
│        │         (feedback)      (you respond)            COMMITTED        │
│        │              │                 │                      │            │
│        │              └────────────────-┘                      │            │
│        │                                                       │            │
│        └──────────────────────────────────────────────────────▶ REJECTED   │
│                                                                              │
│   Timeframes:                                                                │
│   • Initial review: 1-4 weeks                                               │
│   • Iteration: 1-2 weeks per round                                          │
│   • Commit: depends on release schedule                                     │
│   • Total: 1-6 months for non-trivial patches                              │
│                                                                              │
│   Commitfest schedule:                                                       │
│   • January, March, July, September, November                               │
│   • Each runs for ~1 month                                                  │
│   • Your patch gets reviewed during CF                                       │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

14.8 Community Etiquette

Do’s ✅

  • Be patient: Reviews take time; contributors are volunteers
  • Be grateful: Thank reviewers, even for criticism
  • Be thorough: Complete patches save everyone time
  • Be responsive: Reply within a few days
  • Be humble: Even experts learn from review
  • Research first: Check archives before asking

Don’ts ❌

  • Don’t ping repeatedly: One follow-up after 2 weeks is fine
  • Don’t argue endlessly: Accept consensus gracefully
  • Don’t take criticism personally: Focus on the code
  • Don’t abandon patches: Update or withdraw properly
  • Don’t submit massive patches: Break into smaller pieces
  • Don’t ignore feedback: Address all comments

Sample Interactions

> I don't think we need this feature. Users can already do X.

Thanks for the feedback. I see your point about X.

However, I think this is still valuable because:
1. The current workaround requires 3 steps
2. It's error-prone (see bug #1234)
3. Other databases have this built-in

Would it help if I showed some user requests from the mailing list?

If the consensus is against, I'm happy to withdraw the patch.
I appreciate you taking the time to review!

-- 
Your Name

14.9 Building Your Reputation

Progression Path

Year 1:
├── Review 10+ patches (easier than writing)
├── Submit 2-3 doc fixes
├── Fix 1-2 small bugs
└── Attend PGConf (virtual or in-person)

Year 2:
├── Regular reviews (become known)
├── Submit minor features
├── Write blog posts about PostgreSQL internals
└── Help newcomers on mailing lists

Year 3+:
├── Tackle larger features
├── Get nominated for contributor awards
├── Become go-to person for specific area
└── Potentially become a committer

Getting Recognized

  • Conference talks: Submit to PGConf, PGDay events
  • Blog posts: Write about your contribution journey
  • PostgreSQL Weekly: Get your patches mentioned
  • Review consistently: Reviewers are highly valued
  • Mentor others: Help newcomers get started

14.10 Practice: Your First Contribution

1

Find a Documentation Issue

Browse doc/src/sgml/ for unclear function documentation. Pick one function you understand well.
2

Improve the Documentation

Add a clear example, fix unclear wording, or add missing details.
3

Test Your Changes

Build the docs and verify your changes render correctly.
cd doc/src/sgml
make html
4

Create and Submit Patch

Generate a proper patch file and email it to pgsql-hackers.
5

Register in Commitfest

Add your patch to the current commitfest and wait for review.

14.11 Resources


Congratulations! 🎉

You’re now ready to contribute to PostgreSQL. Remember:
  • Start small: Documentation and bug reports are valuable
  • Be patient: The process takes time but is rewarding
  • Stay engaged: Consistency matters more than size
  • Have fun: You’re improving a project used by millions!

Next Module

Module 15: Senior Interview Mastery

Ace database questions in senior engineering interviews