暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

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

digoal 2017-03-13
113
TAG 13

作者

digoal

日期

2017-03-13

标签

PostgreSQL , 10.0 , identify column


背景

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

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

对于从其他数据库迁移到PostgreSQL来说,无疑是福音。

```
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.
```

这个patch的讨论,详见邮件组,本文末尾URL。

PostgreSQL社区的作风非常严谨,一个patch可能在邮件组中讨论几个月甚至几年,根据大家的意见反复的修正,patch合并到master已经非常成熟,所以PostgreSQL的稳定性也是远近闻名的。

参考

https://commitfest.postgresql.org/13/767/

https://www.postgresql.org/message-id/attachment/50108/v4-0001-Identity-columns.patch

https://www.postgresql.org/message-id/flat/6adbacbf-73bc-dd1a-2033-63409180fd18@2ndquadrant.com#6adbacbf-73bc-dd1a-2033-63409180fd18@2ndquadrant.com

https://en.wikipedia.org/wiki/Identity_column

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论