V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
yjqiang

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

  •  
  •   yjqiang · Feb 5, 2019 · 1930 views
    This topic created in 2645 days ago, the information mentioned may be changed or developed.
    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 replies    2019-02-06 17:58:40 +08:00
    wd
        1
    wd  
       Feb 6, 2019 via iPhone
    这其实没什么好吐槽的,各种软件多少都会有一些开发者觉得合理的设定,你有你的道理,他们有他们的,学习掌握就好了,没办法。实在不服气自己改代码做自己想做的
    yjqiang
        2
    yjqiang  
    OP
       Feb 6, 2019
    @wd 就是感觉有点骚气。。。用还是要用的(真香)毕竟比较小型化
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1149 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 65ms · UTC 17:19 · PVG 01:19 · LAX 10:19 · JFK 13:19
    ♥ Do have faith in what you're doing.