Cheat Sheet for PostgreSQL

Updated , First Published by Pete Freitag

When I created my list of cheat sheets for web development last week, I left out PostgreSQL. Frank Reiser, asked why it was left out - and the reason was simply that I couldn't find one.

Being a PostgreSQL fan, I decided to create a cheat sheet for postgresql myself. It prints out in a little over 1.5 pages.

If you have any suggestions please comment below.

Here's another tip for you, use stack.watch to get an email whenever new security vulnerabilities are published in PostgreSQL.

Comments

Brandon Harper

Looks good Pete. You might want to add the creation of an integer sequence and then a create table statement which using a column which references that sequence for auto-numbering?

Pete Freitag

Hey Brandon, I'm using the serial datatype in my CREATE TABLE example which is a shortcut datatype for doing auto numbering in postgresql: http://www.postgresql.org/docs/current/static/datatype.html#DATATYPE-SERIAL

Brandon Harper

Oh cool, good to know. I've just recently been finally playing with PostgreSQL and all of the examples I've seen use sequences, so I just assumed that was THE way it was done.

Pete Freitag

Yeah, that's what serial does behind the scenes it creates the sequences for you. People probably use the more descriptive syntax because that's what pg_dump will show you.

Guillaume Lelarge

This sheet is great. Would you allow me to translate it in french and publish it on the postgresqlfr.org website ? Thanks, Guillaume.

Pete Freitag

Guillaume, Yes please translate it into french. I just ask that you also link to my english version from that page. Thanks

Guillaume Lelarge

Thank you, it's done. You can find it on http://www.postgresqlfr.org/?q=node/368 There's a link at the beginning to your english version. Of course, I also kept the copyright notice.