[sqlite] Tsan Bug in WAL mode

2018-05-22 Thread Ben Asher
Hi there! I believe I've found a SQLite bug that triggers TSAN. I'm hoping to either confirm this bug or learn what I'm doing wrong. Some background: in our code, we make sure to synchronize writes to our database such that only one write can happen at any given time for the same database in our

[sqlite] Proper parameter usage in FTS5 queries

2018-05-22 Thread Ben Asher
Hi there! I'm working with a FTS5 query like this: SELECT rowid FROM text_fts_index WHERE text MATCH ? The parameter is something like this: "user input"* The idea here is to do a MATCH prefix-type query in FTS5. The problem with this query is that it breaks if the user input contains double

Re: [sqlite] ALTER TABLE

2018-05-22 Thread David Raymond
Small note on this: Don't forget any indexes, triggers, etc. They will carry over when the rename table is done, but they'll have their original names. So if you have a table foo with index foo_idx, and do "alter table foo rename to bar", then you'll have index foo_idx on table bar. Which means

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Charles Leifer
SQLite supports renaming tables, so in my experience you move the old table out of the way, and create the new table with the desired schema and the original name. On Tue, May 22, 2018 at 2:34 PM, Igor Korot wrote: > Hi, Charles, > > On Tue, May 22, 2018 at 2:30 PM, Charles

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Thomas Kurz
Thanks for all explanations. The background of my question wasn't about speed, but about easier handling. It would be perfectly ok if Sqlite did more or less the same as when currently manually recreating/copying the table. I just would appreciate having an intuitive (and easy-to-read) SQL

Re: [sqlite] ALTER TABLE

2018-05-22 Thread David Raymond
Some of these things can get taken care of by simply messing with the sqlite_master table contents. Renaming a field for example would "just" be basically doing some replacing in the many places field names are used. So the table entry itself, any indexes, views that use that field, triggers,

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Paul Sanderson
To modify column names if you want to live dangerously you could try something like this PS C:\sqlite> sqlite3 writ.db SQLite version 3.23.1 2018-04-10 17:39:29 Enter ".help" for usage hints. sqlite> create table test (c1, c2, c3); sqlite> insert into test values(1, 2, 3); sqlite> pragma

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Stephen Chrzanowski
Thinking off the cuff, there'd be a seven step process for this; Begin Transaction Turn off the PK/FK relationship PRAGMA constraint checks Rename old table to a temp table via whatever means are available Create the new table INSERT INTO the new table Turn on the PK/FK relationship PRAGMA

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Simon Slavin
Just to explain to everyone why these commands are harder than they appear at first, consider ALTER TABLE DROP COLUMN . The problem is not in "deleting" the column of data . All you have to do for that is to rename the column something that can't be typed, and remove any constraints built

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Igor Korot
Hi, Charles, On Tue, May 22, 2018 at 2:30 PM, Charles Leifer wrote: > As a workaround, you can always rename the existing table, create the new > table with desired attributes, and do a INSERT INTO ... SELECT FROM > old_table. Then you can safely drop the old table. But the

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Charles Leifer
As a workaround, you can always rename the existing table, create the new table with desired attributes, and do a INSERT INTO ... SELECT FROM old_table. Then you can safely drop the old table. On Tue, May 22, 2018 at 1:14 PM, Thomas Kurz wrote: > > ALTER TABLE ADD COLUMN

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Thomas Kurz
> ALTER TABLE ADD COLUMN has existed for a long time. Yes, sorry, I mixed things up. The order of importance is imho: 1. RENAME COLUMN (shouldn't be too hard) 2. DROP COLUMN (should be a bit more comlicated but feasible) 3. MODIFY COLUMN > What kind of MODIFY COLUMN changes do you have in mind?

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Richard Hipp
On 5/22/18, Thomas Kurz wrote: > I'd like to ask whether there is hope for a more complete support of ALTER > TABLE in the near future, i.e. ADD COLUMN, MODIFY COLUMN, RENAME COLUMN and > DROP COLUMN. ALTER TABLE ADD COLUMN has existed for a long time. What kind of

[sqlite] ALTER TABLE

2018-05-22 Thread Thomas Kurz
I'd like to ask whether there is hope for a more complete support of ALTER TABLE in the near future, i.e. ADD COLUMN, MODIFY COLUMN, RENAME COLUMN and DROP COLUMN. I know about the workaround (alter table rename to, insert, drop table), but this is very inconvenient.

Re: [sqlite] LIMIT with OFFSET is not working in android platform

2018-05-22 Thread Sathish Kumar
Hi Richard, Today, i verified with android NDK 17 and It is working fine without disabling compiler optimization. Thanks, Sathish On Mon, May 21, 2018 at 9:41 PM, Sathish Kumar wrote: > Thanks, I will do that. > > Thanks, > Sathish > > > On Mon 21 May, 2018, 9:34