PostgreSQL 10.0 preview 功能增强 - identify column (SQL标准:T174)

less than 1 minute read


identify column类似PostgreSQL的serial, (自增\减序列). identify column(s)属于SQL标准中的某个特性。

PostgreSQL 10.0将实现这一标准,虽然你已经可以使用serial来达到同样效果,不过实现这一标准,可以兼容更多的数据库。


An Identity column is a column (also known as a field) in a database table that is made up of values generated by the database.   
This is much like an AutoNumber field in Microsoft Access or a sequence in Oracle.   
Because the concept is so important in database science, many RDBMS systems implement some type of generated key, although each has its own terminology.  
An identity column differs from a primary key in that its values are managed by the server and usually cannot be modified.   
In many cases an identity column is used as a primary key; however, this is not always the case.  
It is a common misconception that an identity column will enforce uniqueness; however, this is not the case.   
If you want to enforce uniqueness on the column you must include the appropriate constraint too.  
In Microsoft SQL Server you have options for both the seed (starting value) and the increment. By default the seed and increment are both 1.  




Flag Counter

digoal’s 大量PostgreSQL文章入口