Opened 13 months ago

Last modified 13 months ago

#27452 assigned New feature

Add Postgres serial field to contrib.postgres

Reported by: Johannes Hoppe Owned by: Johannes Hoppe
Component: contrib.postgres Version: 1.10
Severity: Normal Keywords:
Cc: info@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description (last modified by Burhan Khalid)

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 and bigserial 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:

  1. Anywhere an automatic incrementing value is required, but a primary key is often (mis)used.
  2. 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.

Change History (4)

comment:1 Changed 13 months ago by Burhan Khalid

Description: modified (diff)

comment:2 Changed 13 months ago by Johannes Hoppe

I opened a PR with an implementation that I am already using somewhere. It added a couple of tests and documentation too.
I guess this is a good starting point for a discussion.

Last edited 13 months ago by Tim Graham (previous) (diff)

comment:3 Changed 13 months ago by Johannes Hoppe

Owner: set to Johannes Hoppe
Status: newassigned

comment:4 Changed 13 months ago by Tim Graham

Has patch: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted
Note: See TracTickets for help on using tickets.
Back to Top