Thursday, March 6, 2008

PostgreSQL SERIAL Saved My Life

I needed to prototype a small application that needed a database back-end. I usually just use the Python ODBC bindings (pyodbc), so as long as I had an ODBC driver installed, it didn't really matter which database management system I used.

Being sound of mind, I chose PostgreSQL and began sketching out my simple schema. I ran into a snag because I didn't know how to simulate the ever increasing identifier integer, like MySQL's auto_increment or Microsoft SQL Server's IDENTITY. Enter the pseudo-type SERIAL. It works exactly the same, but on a DBMS you can bring home to your parents.

Check it out here:

No comments:

Post a Comment