Re: [sqlite] obscure bug: duplicate rowid after insert or replace

2017-05-01 Thread Keith Medcalf
> INSERT OR REPLACE, where the new record is a duplicate, does a DELETE and > then an INSERT. In other words, there’s a short time when the old record > has been deleted but the new record hasn’t been inserted yet. The result > is not the same as if SQLite did an UPDATE instead. Since the

Re: [sqlite] obscure bug: duplicate rowid after insert or replace

2017-05-01 Thread Simon Slavin
On 2 May 2017, at 1:35am, Stephen Chrzanowski wrote: > I was just looking at the ticket, and was wondering if that actually is the > right answer? > > Does REPLACE do an actual INSERT regardless if the PK exists? Doesn't it > search and and update? If NULL is the key,

Re: [sqlite] obscure bug: duplicate rowid after insert or replace

2017-05-01 Thread Stephen Chrzanowski
I was just looking at the ticket, and was wondering if that actually is the right answer? Does REPLACE do an actual INSERT regardless if the PK exists? Doesn't it search and and update? If NULL is the key, wouldn't it do a search for PK of NULL (Doesn't exist) and replace that, essentially

Re: [sqlite] sqlite3_open_v2("",... schema name?

2017-05-01 Thread Cezary H. Noweta
Hello, On 2017-04-28 12:16, Olivier Mascia wrote: http://sqlite.org/c3ref/open.html says: "If the filename is an empty string, then a private, temporary on-disk database will be created. This private database will be automatically deleted as soon as the database connection is closed."

Re: [sqlite] obscure bug: duplicate rowid after insert or replace

2017-05-01 Thread Richard Hipp
On 5/1/17, E.Pasma 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 >

Re: [sqlite] obscure bug: duplicate rowid after insert or replace

2017-05-01 Thread R Smith
I've managed to reproduce this down to SLIte 3.8.1 so far... going lower will take more time, but I will get there. Also, if it helps, pragma integrity_check succeeds with Ok. Multiple inserts of the same type keeps duplicating, and keeps working. REINDEX, ANALYZE and VACUUM all works without

Re: [sqlite] obscure bug: duplicate rowid after insert or replace

2017-05-01 Thread Richard Hipp
On 5/1/17, Richard Hipp wrote: > > What were you expecting this to do? > Never mind. After actually running the test case, I see that it gives an assertion fault. We're working on it. -- D. Richard Hipp d...@sqlite.org ___

Re: [sqlite] obscure bug: duplicate rowid after insert or replace

2017-05-01 Thread R Smith
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

Re: [sqlite] obscure bug: duplicate rowid after insert or replace

2017-05-01 Thread Stephen Chrzanowski
I'm not the OP, but I would have expected a fail to replace. sqlite> create table t(i integer primary key, a text); sqlite> insert into t values (null,'generates row 1'); sqlite> replace into t values (null,'generates row 2'),(1,'replaces row 1'); sqlite> select * from t; 1|generates row 1

Re: [sqlite] obscure bug: duplicate rowid after insert or replace

2017-05-01 Thread Richard Hipp
On 5/1/17, E.Pasma 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,

[sqlite] obscure bug: duplicate rowid after insert or replace

2017-05-01 Thread E . Pasma
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') ; It is alright