V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yjqiang
V2EX  ›  分享发现

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

  •  
  •   yjqiang · 2019-02-05 23:58:20 +08:00 · 1563 次点击
    这是一个创建于 1913 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 么?
    2 条回复    2019-02-06 17:58:40 +08:00
    wd
        1
    wd  
       2019-02-06 08:35:17 +08:00 via iPhone
    这其实没什么好吐槽的,各种软件多少都会有一些开发者觉得合理的设定,你有你的道理,他们有他们的,学习掌握就好了,没办法。实在不服气自己改代码做自己想做的
    yjqiang
        2
    yjqiang  
    OP
       2019-02-06 17:58:40 +08:00
    @wd 就是感觉有点骚气。。。用还是要用的(真香)毕竟比较小型化
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2255 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 07:58 · PVG 15:58 · LAX 00:58 · JFK 03:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.