Pete Freitag Pete Freitag

Cheat Sheet for PostgreSQL

Updated on April 13, 2021
By Pete Freitag
databases

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.



postgresql cheatsheets sql cheat sheet

Cheat Sheet for PostgreSQL was first published on September 07, 2005.

If you like reading about postgresql, cheatsheets, sql, cheat, or sheet then you might also like:

Discuss / Follow me on Twitter ↯

Comments

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?
by Brandon Harper on 09/07/2005 at 8:39:52 PM UTC
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
by Pete Freitag on 09/08/2005 at 11:24:44 AM UTC
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.
by Brandon Harper on 09/08/2005 at 11:42:08 AM UTC
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.
by Pete Freitag on 09/08/2005 at 11:50:10 AM UTC
This sheet is great. Would you allow me to translate it in french and publish it on the postgresqlfr.org website ?

Thanks,
Guillaume.
by Guillaume Lelarge on 09/09/2005 at 4:21:21 AM UTC
Guillaume, Yes please translate it into french. I just ask that you also link to my english version from that page.

Thanks
by Pete Freitag on 09/09/2005 at 8:49:46 AM UTC
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.
by Guillaume Lelarge on 09/09/2005 at 10:43:59 AM UTC
Thanks Guillaume!
by Pete Freitag on 09/09/2005 at 11:19:38 AM UTC