Introduction to Hacking PostgreSQL


Gavin Sherry and I have presented several versions of a tutorial introduction
on how to modify the PostgreSQL source code. The original version was given at
the PostgreSQL Anniversary Summit in June of 2006. Gavin has since given a
revised version of the talk (at LCA 2007), as have I (at PgCon 2007).

All three versions of the talk follow a similar format: the first 90 minutes
provid a general introduction to the backend, common coding conventions, and
the procedure that is typically followed for submitting a new patch. The second
90 minutes walk the audience through an example patch.

Ottawa (PgCon 2007)

Australia (LCA 2007)

Gavin presented an updated version of this tutorial at the PostgreSQL mini-conf that
preceded LCA 2007. The slides and handouts
for that talk are available.

Toronto (Anniversary Summit, 2006)

  • Presentation Slides
  • An example patch that adds support for the WHEN clause to
    the CREATE TRIGGER statement
  • Handout of notable sections of code from the example patch;
    when the slides include statement like “see page n“, they are referring to pages from
    this handout

Other Talks

I’ve given two other talks on PostgreSQL internals:

Tom Lane gave a great talk on “recent” improvements to the PostgreSQL query
in 2003. Despite being slightly dated, it is still
worth reading.


  • October 31, 2007: Added links to other talks on Postgres internals, added some new content to the Ottawa slides.
  • May 21, 2007: Added Ottawa version of the talk.
  • May 9, 2007: Linked to Gavin’s modified LCA talk.
  • July 11, 2006: Initial version posted.
  • July 21, 2006: Made various minor corrections to the slides. Added email addresses for Gavin and myself.

Read More