Well, I for one expected that script to produce on completion a table t with two rows like this:

1, 'replaces tow 1'
2, 'generates row 2'

But the actual script produces a confusing table with a duplicate Primary Key (Row-id alias no less), like this:
(Using SQLite 3.17.0)

CREATE TABLE t(i INTEGER PRIMARY KEY, a TEXT);

INSERT INTO t VALUES
    (NULL, 'generates row 1')
;

SELECT * FROM t;

  --       i      | a
  -- ------------ | -----------------
  --       1      | generates row 1


REPLACE INTO t VALUES
    (NULL, 'generates row 2'),
    (1, 'replaces row 1')
;


SELECT * FROM t;

  --  i  | a
  -- --- | -----------------
  --  1  | generates row 1
  --  1  | replaces row 1


Surely that ain't right? Or am I missing something?


On 2017/05/01 6:41 PM, Richard Hipp wrote:
On 5/1/17, E.Pasma <pasm...@concepts.nl> wrote:
Hello, I have a duplicate rowid in a 3.16.2 database and this is
essentially produced as follows:

CREATE TABLE t(i INTEGER PRIMARY KEY, a TEXT);;
INSERT INTO t VALUES
      (NULL, 'generates row 1');
REPLACE INTO t VALUES
      (NULL, 'generates row 2'),
      (1, 'replaces row 1');
What were you expecting this to do?


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to