For the second insert in the code below I expected a failure. From the
diagrams in the create index doc I understand the WHERE ts_to ISNULL is
legal. Do I misunderstand the docs or is there an other place where I
should look. I'm awar that I could use some future data as default for
ts_to but it is not elegant to me,

TIA,

ingo

---%<------%<------%<---

CREATE TABLE IF NOT EXISTS person (
  pid INTEGER NOT NULL,
  full_name TEXT,
  ts_to TEXT DEFAULT NULL
);

CREATE UNIQUE INDEX IF NOT EXISTS idx_person
    ON person (pid, ts_to)
 WHERE ts_to ISNULL
;

INSERT INTO person (pid, full_name)
VALUES (1,'pietje puk');

INSERT INTO person (pid, full_name)
VALUES (1,'jan tabak');  -----> should fail??

SELECT * FROM person WHERE ts_to ISNULL;
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to