Re: [sqlite] ENABLE_UPDATE_DELETE_LIMIT

2016-07-12 Thread Chris Brody
Thanks, definitely looks straightforward to me. On Tue, Jul 12, 2016 at 11:14 AM, Jan Nijtmans wrote: > 2016-07-12 11:03 GMT+02:00 Chris Brody: >> Personally I would really like to see this. Can you show the patch somewhere? > > Here is the patch. I'm not sure that the

Re: [sqlite] ENABLE_UPDATE_DELETE_LIMIT

2016-07-12 Thread Jan Nijtmans
2016-07-12 11:03 GMT+02:00 Chris Brody: > Personally I would really like to see this. Can you show the patch somewhere? Here is the patch. I'm not sure that the SQLite mailing list accepts attachments, but your private mail surely does. The patch is generated against current SQLite trunk.

Re: [sqlite] Bug Report: All database opening blocked awaiting wal index rebuild

2016-07-12 Thread Olivier Mascia
> Le 11 juil. 2016 à 21:57, Brian Vincent a écrit : > > Yes, you seem to understand the issue. The issue only happens when using > shared caches. > > I've reproduced the issue using both SERIALIZED and MULTITHREADED modes. > ... > Being an inherit limitation would seem to

Re: [sqlite] ENABLE_UPDATE_DELETE_LIMIT

2016-07-12 Thread Jan Nijtmans
2016-07-11 17:23 GMT+02:00 Richard Hipp: > Yes. ENABLE_UPDATE_DELETE_LIMIT makes changes to the LALR(1) parser > tables which cannot be #ifdef-ed out. So there is not a convenient > way to turn that feature off and on at compile-time except to rerun > the Lemon parser generator, which basically

Re: [sqlite] ENABLE_UPDATE_DELETE_LIMIT

2016-07-12 Thread Chris Brody
> Actually, it is very well possible to build an amalgamation which can > be built with or without ENABLE_UPDATE_DELETE_LIMIT, and > functions fine as expected both ways without rerunning Lemon. If you > are interested in a patch which demonstrates this, I'm happy to provide that. Personally I

[sqlite] Possible index corruption

2016-07-12 Thread Miroslav Rajcic
I am using sqlite to implement document file format in my program. I got a document file (sqlite database) from user where the image embedded into the document note is displayed OK, but disappears on the next load of the same document (even if no user editing action was done). The only

Re: [sqlite] Bug: SQLite's include guards are reserved identifiers

2016-07-12 Thread Cory Nelson
On Fri, Jul 8, 2016 at 6:56 PM, Daniel Seither wrote: > Using clang 3.8 with -Wreserved-id-macro (enabled by -Weverything), I > just noticed that SQLite uses include guards with a leading underscore, > for example _SQLITE3_H_ in the amalgamation. According to the C > standard, this

Re: [sqlite] Bug: SQLite's include guards are reserved identifiers

2016-07-12 Thread Richard Damon
On 7/12/16 12:58 AM, dandl wrote: Try to write a fully standard compliant standard library without using any of the reserved namespace!!! This is the key point that has been missed so far. The C/C++ standards do not provide a mechanism by which the supplier of a library can reserve or

Re: [sqlite] Query question: order by ascending, return the two largest values in ascending order

2016-07-12 Thread Keith Christian
Thanks for all of the responses. Duplicates are OK, the date time stamps are part of a log file that I am trying to develop a query for. I couldn't get the LIMIT/OFFSET part of the query right after several attempts so I thought I'd ask the experts here. I appreciate your replies and

[sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread Dominique Devienne
C:\Users\ddevienne>sqlite3 SQLite version 3.10.2 2016-01-20 15:27:19 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> create table t (id integer primary key autoincrement, name text unique); sqlite> insert

Re: [sqlite] Cyclic detection in recursive queries

2016-07-12 Thread Richard Hipp
On 7/12/16, New, Cecil (GE Aviation, US) wrote: > The best I have been able to come with is documented at: > http://stackoverflow.com/questions/32640043/cannot-detect-cyclic-data-in-an-sqlite-database/32719216#32719216\ So you have a graph with loops. What is your problem,

Re: [sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread Dominique Devienne
On Tue, Jul 12, 2016 at 2:12 PM, Dominique Devienne wrote: > C:\Users\ddevienne>sqlite3 > SQLite version 3.10.2 2016-01-20 15:27:19 > Enter ".help" for usage hints. > Connected to a transient in-memory database. > Use ".open FILENAME" to reopen on a persistent database. >

Re: [sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread Dominique Devienne
On Tue, Jul 12, 2016 at 2:31 PM, Richard Hipp wrote: > On 7/12/16, Dominique Devienne wrote: > > > > Is that normal or expected? > > The operation of REPLACE is defined here: > >

[sqlite] Cyclic detection in recursive queries

2016-07-12 Thread New, Cecil (GE Aviation, US)
The best I have been able to come with is documented at: http://stackoverflow.com/questions/32640043/cannot-detect-cyclic-data-in-an-sqlite-database/32719216#32719216 But a) it is ugly, b) performance impact of all the length(), replace() functions, c) if values end in similar strings, it

Re: [sqlite] Redundant open *.sqlite-wal file

2016-07-12 Thread Robby Helperin
Hi, Richard, Funny I got this email because you actually called me on the phone yesterday and I just missed your call. You were returning my call to your team. I had called in the hopes of being pointed in the right direction for someone to help me with two small things with my program. 1)

Re: [sqlite] Query question: order by ascending, return the two largest values in ascending order

2016-07-12 Thread Chris Locke
Whats the benefit of getting a sorted query and then sorting that query again? On Tue, Jul 12, 2016 at 12:45 AM, Stephen Chrzanowski wrote: > Simons + My answer; > > select * from (SELECT date_time_stamp FROM general ORDER BY date_time_stamp > DESC LIMIT 2) a order by

Re: [sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread Clemens Ladisch
Dominique Devienne wrote: > sqlite> select * from t; > 1|one bis > 2|two > sqlite> insert or replace into t (name) values ('one bis'); > sqlite> select * from t; > 2|two > 3|one bis > > In the session above, we can see that an insert or replace w/o an id (the PK) > value, > results in the id

Re: [sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread Simon Slavin
On 12 Jul 2016, at 1:26pm, Clemens Ladisch wrote: > An INSERT OR UPDATE (or MERGE) statement does not exist in SQLite. > > Just try the UPDATE, and if the number of affected rows is zero, do the > INSERT. I prefer to do INSERT OR IGNORE ... UPDATE ... That way you do not

Re: [sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread Hick Gunter
The conflict action "replace" looks at ALL the PRIMARY KEY and UNIQUE constraints (express or implied) and deletes ALL the existing rows that prevent the candidate row from being inserted. As in "I don't care what it takes, I want THIS row to be in the table." The other conflict actions just

Re: [sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread R Smith
On 2016/07/12 3:55 PM, R Smith wrote: On 2016/07/12 2:12 PM, Dominique Devienne wrote: In the session above, we can see that an insert or replace w/o an id (the PK) value, results in the id changing in the table, which is not what we'd like. etc. By the way, another important problem

Re: [sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread R Smith
On 2016/07/12 2:12 PM, Dominique Devienne wrote: In the session above, we can see that an insert or replace w/o an id (the PK) value, results in the id changing in the table, which is not what we'd like. If you ask any DB engine to INSERT, and you do not specify the autoinc/pk/identity ID,

Re: [sqlite] Query question: order by ascending, return the two largest values in ascending order

2016-07-12 Thread Clemens Ladisch
Clemens Regards, 2. Sorting the entries before LIMIT is applied. 1. Sorting the entries before group_concat() is applied; or Chris Locke wrote: > Whats the benefit of getting a sorted query and then sorting that query > again? > > On Tue, Jul 12, 2016 at 12:45 AM, Stephen Chrzanowski

Re: [sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread Richard Hipp
On 7/12/16, Dominique Devienne wrote: > > Is that normal or expected? The operation of REPLACE is defined here: https://www.sqlite.org/mark/lang_conflict.html?the+REPLACE+al*+current+row#mark -- D. Richard Hipp d...@sqlite.org

Re: [sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread Dominique Devienne
Thank you all, Clemens, Richard, Simon, Hick. Now we know OR REPLACE is never what we want (in our use cases), and will rewrite into two statements, as Clemens and Simon indicated. --DD ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

Re: [sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread Simon Slavin
On 12 Jul 2016, at 1:39pm, Dominique Devienne wrote: > So the plural in "deletes pre-existing rows" explain that in my second > example, > with both the PK and NK where each point to different rows, both rows are > first > deleted, then the new row is inserted? Correct.

Re: [sqlite] Cyclic detection in recursive queries

2016-07-12 Thread Jean-Luc Hainaut
On 12/07/2016 13:59, New, Cecil (GE Aviation, US) wrote: The best I have been able to come with is documented at: http://stackoverflow.com/questions/32640043/cannot-detect-cyclic-data-in-an-sqlite-database/32719216#32719216 But a) it is ugly, b) performance impact of all the length(), replace()

Re: [sqlite] Lemon doesn't reset `yyerrcnt` after error

2016-07-12 Thread Richard Hipp
On 7/9/16, Nick Wellnhofer wrote: > > This still doesn't work for me. OK. Another fix. Please try the latest trunk version. Note to passive readers of this thread: none of this has any impact on SQLite. SQLite does not use the feature of the Lemon LALR(1) parser