Changes between Initial Version and Version 1 of Ticket #27452

Nov 6, 2016, 5:55:50 AM (7 years ago)
Burhan Khalid


  • 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.
    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`.
    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: describes the field as follows:
     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).
     9**Use Cases:**
     111. Anywhere an automatic incrementing value is required, but a primary key is often (mis)used.
     122. Providing additional (user controlled) auto-incrementing values.
     15The primary benefit is that is isolates the primary key for the sole use of maintaining referential integrity.
Back to Top