Test Driven Database Development

David Wheeler (iovation)
Location: Portland 252
Please note: to attend, your registration must include Tutorials.
Average rating: **...
(2.94, 16 ratings)

Creating a database schema means creating an interface for applications to use to manage their data. But how do you know how well that interface works until you’ve tried it?

Well, by trying it before you create it.

This talk introduces the concept of test-driven development to database administrators. We’ll use pgTAP to work through a real-world example creating a database design with an intuitive, useful interface for managing application data. Derive more intuitive table structures! Keep an eye to the beauty of your views! Let your procedures make your application more productive! Feel younger and more clever, all through the power of TDDD!

NOTE: Instructions for this tutorial may be found here.

Photo of David Wheeler

David Wheeler


David E. Wheeler is President of Portland-based Kineticode and Co-Founder of PostgreSQL Experts. David also maintainers and leads development of Bricolage, a content management and publishing system powered by Perl and PostgreSQL. For his next trick, he may or may not build a Python or Lisp or BASIC-powered Web application, but whatever it is, it will likely be built on PostgreSQL. Unless it’s a blog, in which case he’ll just use SQLite.

Comments on this page are now closed.


Picture of Jeff Adelsberger
Jeff Adelsberger
07/25/2010 9:55pm PDT

Great topic and information. The hands on thing seemed like it could have been replaced with a more streamlined interactive element and gotten more information across.

Picture of David Wheeler
David Wheeler
07/21/2010 6:29am PDT

Thanks for coming, Shaun (and David). I’m pleased you got more out of it this time around. So much better not to be rushed, eh?



Shaun Abram
07/21/2010 6:19am PDT

David, Thanks for the repeat session and for all your help. It all made much more sense this time! It was an excellent introduction for me into TDDD.


Picture of David Wheeler
David Wheeler
07/20/2010 1:20pm PDT


I created a PDF, but it’s 200MB. I thought that would be unfair. Don’t know how to get the size down, alas.


Sounds like the binary build of PostgreSQL you’ve installed used a newer version of libxml than your install has. I didn’t realize that pg_regress used libxml—can you connect to the database at all? If so, just ignore make installcheck for now.

Thanks for writing, guys!


Shaun Abram
07/20/2010 11:56am PDT

David, thanks for posting the slides.

Unfortunately even after trying for a few more hours, I still have been unable to get all the required software for the tutorial running together. When I try the ‘make installcheck’ command for pgtap, I get the error below. I am running on a Macbook Pro with OS X 10.5.8. I know this is a environment specific problem, but if you have any suggestions, they would be much appreciated!

dyld: Library not loaded: /usr/local/lib/libxml2.2.dylib Referenced from: /Library/PostgreSQL/8.4/lib/postgresql/pgxs/src/makefiles/../../src/test/regress/pg_regress Reason: Incompatible library version: pg_regress requires version 10.0.0 or later, but libxml2.2.dylib provides version 9.0.0

Picture of David Hancock
David Hancock
07/20/2010 8:42am PDT

It was unfortunate to have spent half of the time simply getting most (some?) of the attendees with prerequisites. I would like to have had handouts (very prehistoric of me, I know), or at least a prestaged presentation file (preferably a nice cross-platform PDF). Having the code readily available ahead of time would have helped, also.

David is a witty writer and speaker, but that wit got lost in the shuffle of getting attendees to the point they should have been before the session started!

Picture of Dan Buch
Dan Buch
07/19/2010 9:29am PDT

The logistics of getting everybody a working dev environment really bogged down David’s momentum. I’d really like to see this talk as a straight pitch for TDDD using pgTAP without the hands-on aspect.

Picture of David Wheeler
David Wheeler
07/19/2010 7:34am PDT

FYI, you’ll want to download one of the “oscon-1.0” packages.

Picture of David Wheeler
David Wheeler
07/19/2010 7:33am PDT

Hey Shaun,

I’ve tagged the Git repository, so now you can download a .zip or .tgz file of the Keynote file and all the source files from here. Hopefully, once you unpack the download, you’ll be able to load the .key file.



Shaun Abram
07/19/2010 6:21am PDT

Dave, I tried to download the presentation slides from github.com/theory/tddd/blob... I assume that is a (iWork) Keynote file? But when I try to open (Keynote ‘09 v5.0.3), I get an error saying ‘the document does not have a valid format’.

Any idea?



Picture of Shirley Bailes
Shirley Bailes
07/12/2010 3:59am PDT

@David… Please see the notes the speaker, David Wheeler, has added for Windows users here: www.oscon.com/oscon2010/pub...

Picture of David Hancock
David Hancock
07/10/2010 8:18am PDT

I’m trying to get course prerequisites set up on a Windows XP laptop. PostgreSQL and Test::Harness, no problem. But I’m not sure how to get pgTAP working under Windows. Any pointers would be appreciated.

  • Intel
  • Microsoft
  • Google
  • Facebook
  • Rackspace Hosting
  • (mt) Media Temple, Inc.
  • ActiveState
  • CommonPlaces
  • DB Relay
  • FireHost
  • GoDaddy
  • HP
  • HTSQL by Prometheus Research
  • Impetus Technologies Inc.
  • Infobright, Inc
  • JasperSoft
  • Kaltura
  • Marvell
  • Mashery
  • NorthScale, Inc.
  • Open Invention Network
  • OpSource
  • Oracle
  • Parallels
  • PayPal
  • Percona
  • Qualcomm Innovation Center, Inc.
  • Rhomobile
  • Schooner Information Technology
  • Silicon Mechanics
  • SourceGear
  • Symbian
  • VoltDB
  • WSO2
  • Linux Pro Magazine

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at the conference, contact Sharon Cordesse at scordesse@oreilly.com

Download the OSCON Sponsor/Exhibitor Prospectus

Media Partner Opportunities

Download the Media & Promotional Partner Brochure (PDF) for information on trade opportunities with O'Reilly conferences or contact mediapartners@ oreilly.com

Press and Media

For media-related inquiries, contact Maureen Jennings at maureen@oreilly.com

OSCON Newsletter

To stay abreast of conference news and to receive email notification when registration opens, please sign up for the OSCON Newsletter (login required)

OSCON 2.0 Ideas

Have an idea for OSCON to share? oscon-idea@oreilly.com

Contact Us

View a complete list of OSCON contacts