Re: [sqlite] sqlite-users Digest, Vol 126, Issue 28

2018-06-28 Thread Keith Medcalf
Hmmm. SQLite version 3.25.0 2018-06-21 23:53:54 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> .eqp on sqlite> create table t(id integer primary key not null, pid references t(id), body varchar);

Re: [sqlite] column types and constraints

2018-06-28 Thread David Burgess
"This flexible type-name arrangement works because SQLite is very forgiving about you putting non-proscribed values into columns - it tries to convert if it can do so without loss of information but if it cannot do a reversible type conversion it simply stores whatever you give it. Hence if you

Re: [sqlite] column types and constraints

2018-06-28 Thread Thomas Kurz
I understand that you do not want to break compatibility. But couldn't a PRAGMA STRICT_SQL (or the like) be introduced that would force to a) reject CREATE statements with unknown declarations (I often use "STRING" for the datatype, leading to hard-to-find problems as SQLite uses a numeric type

Re: [sqlite] insert or replace performance with self "references" column

2018-06-28 Thread Simon Slavin
On 27 Jun 2018, at 11:20pm, Allen wrote: > I have a table with an additional index and a query: > > "create table Transactions (Id integer primary key not null, Parent > references Transactions(id), Body varchar);" > > "create index Parent_Index on Transactions (Parent);" > > EXPLAIN QUERY

Re: [sqlite] sqlite-users Digest, Vol 126, Issue 28

2018-06-28 Thread Allen
> If you give the parent column a proper affinity (ie, integer) do you get > "happiness making" results? nope, made no difference > Date: Wed, 27 Jun 2018 17:47:01 -0600 > From: "Keith Medcalf" > To: "SQLite mailing list" > Subject: Re: [sqlite] insert or replace performance with self >

Re: [sqlite] insert or replace performance with self "references" column

2018-06-28 Thread Clemens Ladisch
Allen wrote: > create table Transactions (Id integer primary key not null, Parent references > Transactions(id), Body varchar); > create index Parent_Index on Transactions (Parent); > > EXPLAIN QUERY PLAN insert or replace into Transactions (Id, Parent, Body) > values (?1, ?2, ?3); > 23 0 0 SCAN

Re: [sqlite] LIMIT

2018-06-28 Thread Richard Rousselot
Just wanted to support the idea of adding windowing functions to SQLite as it is the biggest hurdle for me to get others to use it. If size is an issue, I would love to have a build option to enable it. My $0.02 On Tue, Jun 26, 2018 at 8:27 AM Gert Van Assche wrote: > Thanks Olivier, very

Re: [sqlite] order by column_name collate custom_collation, with virtual table index

2018-06-28 Thread Dominique Devienne
On Thu, Jun 28, 2018 at 2:03 PM Richard Hipp wrote: > On 6/28/18, Dominique Devienne wrote: > > From reading this list, I've learned that for an index to have a change > to > > be used to consume an order by, the collation of the query and the index > > must match. > > > > But in many

Re: [sqlite] Shouldn't have to specify primary key explicitly

2018-06-28 Thread Simon Slavin
On 28 Jun 2018, at 12:48pm, Scott Robertson wrote: > CREATE TABLE test2 ( > id INTEGER PRIMARY KEY, > book text, > page INTEGER > ); > > INSERT INTO test2 VALUES ('Lord of the Rings', 327); > > Error: table test2 has 3 columns but 2 values were supplied > > INSERT INTO test2 VALUES (9, 'Lord

Re: [sqlite] Shouldn't have to specify primary key explicitly

2018-06-28 Thread curmudgeon
>INTEGER PRIMARY KEY doesn’t default to autoincrement. It’s used in place of the automatically created >autoincrement rowid but you have to supply the values (I.e. they’re not created automatically). I stand corrected. If you supply null for the integer primary key it will assign the highest

Re: [sqlite] Shouldn't have to specify primary key explicitly

2018-06-28 Thread x
INTEGER PRIMARY KEY doesn’t default to autoincrement. It’s used in place of the automatically created autoincrement rowid but you have to supply the values (I.e. they’re not created automatically). On 28 Jun 2018, at 12:48, Scott Robertson wrote: > SQLite is supposed to autoincrement by

Re: [sqlite] Shouldn't have to specify primary key explicitly

2018-06-28 Thread Tim Streater
On 28 Jun 2018, at 12:48, Scott Robertson wrote: > SQLite is supposed to autoincrement by default when a column is defined > as "INTEGER PRIMARY KEY" according to everything I've read. But I've > only gotten this to work if I let SQLite create its own PK column. If I > have an explicit PK

Re: [sqlite] order by column_name collate custom_collation, with virtual table index

2018-06-28 Thread Richard Hipp
On 6/28/18, Dominique Devienne wrote: > From reading this list, I've learned that for an index to have a change to > be used to consume an order by, the collation of the query and the index > must match. > > But in many instances, that index is one from a virtual table we implement. > So is there

Re: [sqlite] [EXTERNAL] Shouldn't have to specify primary key explicitly

2018-06-28 Thread Hick Gunter
Supply a NULL for the INTEGER PRIMARY KEY to tell SQLite to "figure it out for yourself" (c) Siddharta Gautama "Buddha" -Ursprüngliche Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Scott Robertson Gesendet: Donnerstag, 28. Juni 2018

Re: [sqlite] [EXTERNAL] order by column_name collate custom_collation, with virtual table index

2018-06-28 Thread Hick Gunter
We are still using sqlite 3.7.14.1 here, so I can't verify what the current code does. Support for virtual tables has been much extended, adding (OTTOMH): - conflict resolution algorithm - support for unchanged columns in UPDATE statements - more detailed xBestIndex return values (# of estimated

[sqlite] Shouldn't have to specify primary key explicitly

2018-06-28 Thread Scott Robertson
SQLite is supposed to autoincrement by default when a column is defined as "INTEGER PRIMARY KEY" according to everything I've read. But I've only gotten this to work if I let SQLite create its own PK column. If I have an explicit PK column, I am expected to specify an ID myself. What am I missing?

Re: [sqlite] [EXTERNAL] order by column_name collate custom_collation, with virtual table index

2018-06-28 Thread Dominique Devienne
On Thu, Jun 28, 2018 at 11:48 AM Dominique Devienne wrote: > > On Thu, Jun 28, 2018 at 11:18 AM Hick Gunter wrote: >> >> The xBestIndex function needs to call the sqlite_vtab_collation() function to query the collation name required for each constraint and return the appropriate index number. >>

Re: [sqlite] [EXTERNAL] order by column_name collate custom_collation, with virtual table index

2018-06-28 Thread Dominique Devienne
On Thu, Jun 28, 2018 at 11:18 AM Hick Gunter wrote: > The xBestIndex function needs to call the sqlite_vtab_collation() function > to query the collation name required for each constraint and return the > appropriate index number. > > Subs: yes, yes, see above > Oh, great! Thanks Gunther!!!

Re: [sqlite] [EXTERNAL] order by column_name collate custom_collation, with virtual table index

2018-06-28 Thread Hick Gunter
The xBestIndex function needs to call the sqlite_vtab_collation() function to query the collation name required for each constraint and return the appropriate index number. Subs: yes, yes, see above -Ursprüngliche Nachricht- Von: sqlite-users

Re: [sqlite] order by column_name collate custom_collation, with virtual table index

2018-06-28 Thread Dominique Devienne
On Thu, Jun 28, 2018 at 10:59 AM Dominique Devienne wrote: > So is there a way to tell SQLite that vindex is of a given custom > collation, > to open the possibility of the index being used? > Note that there's no mention at all of "collation" or "collate" in https://www.sqlite.org/vtab.html so

[sqlite] order by column_name collate custom_collation, with virtual table index

2018-06-28 Thread Dominique Devienne
From reading this list, I've learned that for an index to have a change to be used to consume an order by, the collation of the query and the index must match. But in many instances, that index is one from a virtual table we implement. So is there a way to tell SQLite that vindex is of a given

Re: [sqlite] column types and constraints

2018-06-28 Thread Simon Slavin
On 28 Jun 2018, at 5:43am, Igor Tandetnik wrote: > It's not mentioned here though: > https://sqlite.org/syntax/column-constraint.html The syntax diagrams in the SQLite documentation are ... what's the term ? ... sufficient but not exhaustive. In other words you can use some forms which