Adding sequences in phpPgAdmin
November 15, 2010,
PostgreSQL is a very powerful database engine. A helpful tool for managing PostgreSQL databases is phpPgAdmin. Although it is a good tool some things are a bit quirky.
One of the differences between MySQL and PostgreSQL is how autoincrements work. In MySQL you use the AUTOINCREMENT keywords, in PostgreSQL you use a sequence.
In phpPgAdmin a sequence is created as follows:
- open the database
- find the right schema you want to add the sequence to (for example public)
- click on the option 'sequences'
- add a sequence
That is the easy part. Adding it to the correct column so I could use it is a bit different. In the interface for phpPgAdmin I searched for a long time for the right option how to use the sequence, but could not find it. The good news is that it is not very difficult at all to use it, you just need to know that you cannot do it in the interface.
For me the solution was simple: use it in the default section for a column, for example:
for an integer value.