sqlite 对 INTEGER PRIMARY KEY 的 null 输入是真的骚气。。。

2019-02-05 23:58:20 +08:00
 yjqiang
https://www.sqlite.org/lang_createtable.html#rowid

“ If an INSERT statement attempts to insert a NULL value into a rowid or integer primary key column, the system chooses an integer value to use as the rowid automatically. A detailed description of how this is done is provided separately.”
我表示有点难以接受这个“ feature ”,如果是 int 且 pk 情况下,无论你是否允许 null 输入,都会成功 insert,而且当年 null 输入时,自增 id ( Autoincrement )且无论你是否设置开启了自增功能。
折腾了我一晚上,大家觉得这是一个合理 feature 么?
1577 次点击
所在节点    分享发现
2 条回复
wd
2019-02-06 08:35:17 +08:00
这其实没什么好吐槽的,各种软件多少都会有一些开发者觉得合理的设定,你有你的道理,他们有他们的,学习掌握就好了,没办法。实在不服气自己改代码做自己想做的
yjqiang
2019-02-06 17:58:40 +08:00
@wd 就是感觉有点骚气。。。用还是要用的(真香)毕竟比较小型化

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/533148

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX