Changes between Initial Version and Version 1 of Ticket #27452


Ignore:
Timestamp:
Nov 6, 2016, 5:55:50 AM (8 years ago)
Author:
Burhan Khalid
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27452 – Description

    initial v1  
    11Since 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.
    22
    3 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!
     3That being said, I guess it's a good idea to start with `Serial`.
    44
    5 **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.
     5The PostgreSQL documentation: https://www.postgresql.org/docs/9.1/static/datatype-numeric.html describes the field as follows:
     6
     7 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).
     8
     9**Use Cases:**
     10
     111. Anywhere an automatic incrementing value is required, but a primary key is often (mis)used.
     122. Providing additional (user controlled) auto-incrementing values.
     13
     14
     15The primary benefit is that is isolates the primary key for the sole use of maintaining referential integrity.
Back to Top