Re: [sqlite] Do SQLITE_LOCKED situations call the busy-handler ?

2019-03-19 Thread Keith Medcalf
See also: https://sqlite.org/unlock_notify.html --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Keith

Re: [sqlite] Do SQLITE_LOCKED situations call the busy-handler ?

2019-03-19 Thread Keith Medcalf
SQLITE_LOCKED is an immediate return (that is, it returns immediately, it is not subject to automatic retries or timeouts or the busy/wait handler -- it is an error indication, not necessarily a transient condition). You may use the sqlite3_unlock_notify API (assuming that you have compiled

[sqlite] Do SQLITE_LOCKED situations call the busy-handler ?

2019-03-19 Thread Simon Slavin
(For those playing along at home, SQLITE_LOCKED is a special-case version of SQLITE_BUSY. You get it only when the competing access attempts come from the same connection (multi-tasking) or different connections sharing the same cache.) Suppose I'm in a situation where I would get

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Simon Davies
On Tue, 19 Mar 2019 at 15:07, Tim Streater wrote: > > My use case is a mixture of these. My need is to copy a row from a table in > one db (db1) to a table with identical schema in another db (db2). The > complication is that there is an id column, so the row needs to get a new id > in db2. >

Re: [sqlite] Distinguish type of statements

2019-03-19 Thread Simon Slavin
On 19 Mar 2019, at 8:53pm, siscia wrote: > Do you think it would be possible to add a function that does what I need? No. I've not part of the development team but I think it's quite complicated. Also, the fact that there's already a function which does what you want makes it unlikely

Re: [sqlite] .import fails CHECK constraint on valid data

2019-03-19 Thread Shawn Wagner
A manual INSERT demonstrates the same behavior, actually. Using your Tc table: sqlite> insert into Tc values ('12'); Error: CHECK constraint failed: Tc The thing about .import is that, instead of guessing what type each value it reads is, they're all just bound to an insert statement as strings.

Re: [sqlite] Distinguish type of statements

2019-03-19 Thread siscia
Hi Simon, Thanks! Indeed I thought about a similar solution but it seems a little contrived. Do you think it would be possible to add a function that does what I need? How is the design coordinated? Where should I post my RFC? Cheers, Simone -- Sent from: http://sqlite.1065341.n5.nabble.com/

Re: [sqlite] .import fails CHECK constraint on valid data

2019-03-19 Thread James K. Lowden
On Sun, 10 Mar 2019 17:04:46 -0400 "James K. Lowden" wrote: > Why does the .import command cause the CHECK constraint to fail, when > an ordinary INSERT does not? On Sun, 10 Mar 2019 14:12:33 -0700 Shawn Wagner wrote: > The check constraint is probably being evaluated (with t as a string) >

Re: [sqlite] Distinguish type of statements

2019-03-19 Thread Simon Slavin
On 19 Mar 2019, at 6:40pm, siscia wrote: > Given a statement, is there any way to know if it is an UPDATE, DELETE, > INSERT, SELECT or something else? It's not simple but if you are actually trying to execute that statement, you can register an authorizer function.

[sqlite] Distinguish type of statements

2019-03-19 Thread siscia
Hi All, I am already afraid that the answer to the question will be "no", but it will save a lot of development effort on my side, so is worth to ask. Given a statement, is there any way to know if it is an UPDATE, DELETE, INSERT, SELECT or something else? Thanks, Simone -- Sent from:

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Tim Streater
On 19 Mar 2019, at 13:46, R Smith wrote: > Three ways in SQL to create and fill a table with data from another: > > 1. CREATE ... AS > Example: > CREATE TABLE newTable AS SELECT a,b,c FROM oldTable; > 2. CREATE TABLE + INSERT > Example: > CREATE TABLE newTable(a INT, b REAL, c TEXT); > INSERT

Re: [sqlite] Recursive CTE on tree with doubly linked items

2019-03-19 Thread Joshua Wise
> On Mar 18, 2019, at 5:21 AM, Keith Medcalf wrote: > > UPDATE tree > SET position = (SELECT position FROM _children WHERE id = tree.id) -- > Multiply by x to number by x > WHERE id IN (SELECT id FROM _children); > DELETE FROM _children; > END; I don’t see the window function causing

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Jose Isaias Cabrera
Wow! Thanks. I did not know these choices. Now I do. ;-) From: sqlite-users on behalf of R Smith Sent: Tuesday, March 19, 2019 09:46 AM To: sqlite-users@mailinglists.sqlite.org Subject: Re: [sqlite] INSERTing from another table data I see the "ignore this" retraction, but I thought to

Re: [sqlite] FTS5 Transaction Leads to OOB Read

2019-03-19 Thread Chu
YES. AFL with ASAN. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread R Smith
I see the "ignore this" retraction, but I thought to mention the following any way, for future reference: Three ways in SQL to create and fill a table with data from another: 1. CREATE ... AS Example: CREATE TABLE newTable AS SELECT a,b,c FROM oldTable; (This method has the advantage of being

Re: [sqlite] INSERTing from another table data

2019-03-19 Thread Jose Isaias Cabrera
Ignore this. Sorry. I should always count to 10 before sending things. Apologies. From: sqlite-users on behalf of Jose Isaias Cabrera Sent: Tuesday, March 19, 2019 09:15 AM To: sqlite-users@mailinglists.sqlite.org Subject: [sqlite] INSERTing from another

[sqlite] INSERTing from another table data

2019-03-19 Thread Jose Isaias Cabrera
Greetings. I have this table, create table a (a, b, c); insert into a values (1, 2, 3); insert into a values (2, 3, 4); insert into a values (3, 4, 5); insert into a values (4, 5, 6); insert into a values (5, 6, 7); insert into a values (6, 7, 8); and I also have this table, create

Re: [sqlite] FTS5 Transaction Leads to OOB Read

2019-03-19 Thread Dan Kennedy
That's the error I got too. Now fixed here:   https://sqlite.org/src/info/b3fa58dd7403dbd4 Dan. On 19/3/62 04:22, Dominique Pellé wrote: Chu wrote: The code: ``` CREATE VIRTUAL TABLE t1 USING fts5(content); BEGIN; INSERT INTO t1 (content) VALUES('');

Re: [sqlite] FTS5 Transaction Leads to NULL Pointer

2019-03-19 Thread Dan Kennedy
On 18/3/62 15:48, Chu wrote: The code: ``` CREATE VIRTUAL TABLE t1 USING fts5(content); INSERT INTO t1 VALUES(''); BEGIN ; DELETE FROM t1 WHERE rowid = 1; SELECT * FROM t1 WHERE content MATCH ''; INSERT INTO t1 VALUES('');