Re: [sqlite] I can insert multiple rows with the same primary key when one of the value of the PK is NULL ...

2019-07-18 Thread Keith Medcalf
Except in SQLite where as a documented behavioural anomaly maintained for backwards compatibility it simply means "UNIQUE" (for ROWID tables). And UNIQUE indexes may have NULL components. This is because despite your wishing that your primary key is the primary key, it is not the primary key.

Re: [sqlite] I can insert multiple rows with the same primary key when one of the value of the PK is NULL ...

2019-07-18 Thread Thomas Kurz
> You might prefer adding an explicit NOT NULL on both "client" and "salesman" > columns. > There is an historical reason why SQLite accepts NULL for primary key > column(s). Ok, thanks for the hint, I didn't know that either. But it is a very odd behavior, because PRIMARY KEY per definition do

Re: [sqlite] I can insert multiple rows with the same primary key when one of the value of the PK is NULL ...

2019-07-18 Thread David Raymond
"integer primary key"s cannot contain a null since they're an alias for the rowid. So when you insert a null into them they act similar to autoincrement and automatically fill it in with an unused id. (Current implementation is 1 more than the _current_ highest rowid. Subject to change) If you

Re: [sqlite] I can insert multiple rows with the same primary key when one of the value of the PK is NULL ...

2019-07-18 Thread Stephen Chrzanowski
Actually, I take that back... sqlite> select * from TheTable; 1|Test 2|Test2 3|TestNull1 4|TestNull2 5|TestNull3 So the inserting of NULL in a primary key (Single instance maybe?) will insert the new rowid. Try running a SELECT against your table and see what kind of results you're obtaining.

Re: [sqlite] I can insert multiple rows with the same primary key when one of the value of the PK is NULL ...

2019-07-18 Thread Stephen Chrzanowski
NULL is a special thing. It's never considered unique. SQLite version 3.20.0 2017-08-01 13:24:15 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> create table TheTable (ID Integer, Info Text, PRIMARY KEY (

Re: [sqlite] I can insert multiple rows with the same primary key when one of the value of the PK is NULL ...

2019-07-18 Thread Simon Slavin
On 18 Jul 2019, at 5:02pm, Alexandre Billon wrote: > INSERT INTO sales ("client", "salesman", "revenue") > VALUES ('C1', NULL, 10.0); The value NULL in SQLite means 'value unknown'. It is a special case. If you compare two NULLs SQLite will act as if those values are different. T

Re: [sqlite] I can insert multiple rows with the same primary key when one of the value of the PK is NULL ...

2019-07-18 Thread Olivier Mascia
> Le 18 juil. 2019 à 18:05, J. King a écrit : > >> Hello, >> >> I have created a table. >> >> CREATE TABLE "sales" ( >> "client"TEXT, >> "salesman" TEXT, >> "revenue" REAL, >> PRIMARY KEY("client","salesman") >> );

Re: [sqlite] I can insert multiple rows with the same primary key when one of the value of the PK is NULL ...

2019-07-18 Thread J. King
On 2019-07-18 12:02:18, "Alexandre Billon" wrote: Hello, I have created a table. CREATE TABLE "sales" ( "client" TEXT, "salesman"TEXT, "revenue" REAL, PRIMARY KEY("client","salesman") ); I can run

[sqlite] I can insert multiple rows with the same primary key when one of the value of the PK is NULL ...

2019-07-18 Thread Alexandre Billon
Hello, I have created a table. CREATE TABLE "sales" ( "client"TEXT, "salesman" TEXT, "revenue" REAL, PRIMARY KEY("client","salesman") ); I can run the query below mutliple times without any error

Re: [sqlite] Adapt HAVE_GETHOSTUUID conditional for UIKit for macOS

2019-07-18 Thread Micah Moore
Thanks for the response. Just to clarify, this is separate from the `warning "gethostuuid() is disabled."` exuded from the else portion of the conditional (when targeting iOS). When targeting UIKit for macOS, the conditional gets into the if portion because TARGET_OS_UIKITFORMAC is not included

[sqlite] Bug report: documentation for the SQLite Android bindings should clearly call out their poor query performance

2019-07-18 Thread Edward Pastuszenski
I apologize in advance if this is the wrong place to report bugs with the SQLite Android bindings, but I couldn’t figure out how to file a ticket on that subsite (https://sqlite.org/android/) and didn’t see any contact information there, so I figured I’d try here. Query performance, particularl