Opened 8 years ago
Last modified 4 months ago
#27452 closed New feature
Add Postgres serial field to contrib.postgres — at Version 1
Reported by: | Johannes Maron | Owned by: | |
---|---|---|---|
Component: | contrib.postgres | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | info@…, InvalidInterrupt, Florian Apolloner, Csirmaz Bendegúz | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Since we have the beautiful contrib.postgres
package now, we can add a couple more Postgres specific fields, that are not supported by MySQL but handy to all the Postgres fan boys.
That being said, I guess it's a good idea to start with Serial
.
The PostgreSQL documentation: https://www.postgresql.org/docs/9.1/static/datatype-numeric.html describes the field as follows:
The data types
serial
andbigserial
are not true types, but merely a notational convenience for creating unique identifier columns (similar to the AUTO_INCREMENT property supported by some other databases).
Use Cases:
- Anywhere an automatic incrementing value is required, but a primary key is often (mis)used.
- Providing additional (user controlled) auto-incrementing values.
The primary benefit is that is isolates the primary key for the sole use of maintaining referential integrity.