Opened 8 years ago
Last modified 4 months ago
#27452 closed New feature
Add Postgres serial field to contrib.postgres — at Initial Version
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
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 a serial field. A serial is a 4 byte integer with an implicit sequence. Ergo its and auto increment field for none primary keys! Yeah!
Usecase: You could have a customer number, or invoice number in your code. Usually it is a good idea to not use a natural primary key, therefore reusing the pk as that number could be considered bad. Having a separate field with a separate sequence solves this issue.