[sqlite] Fwd: [sqlite-forum] Convert datetime string to second since Epoch with millisecond precision

2020-03-17 Thread Dominique Devienne
Reposting to the ML, maybe I'll have more luck there, than in the forum? --DD -- Forwarded message - From: ddevienne Date: Tue, Mar 17, 2020 at 5:09 PM Subject: [sqlite-forum] Convert datetime string to second since Epoch with millisecond precision To: Forum post by ddevienne

[sqlite] SQLite forum posts are about the forum, not SQLite

2020-03-13 Thread Dominique Devienne
I hope that's only a temporary situation... --DD ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] New SQLite Forum established - this mailing list is deprecated

2020-03-13 Thread Dominique Devienne
On Fri, Mar 13, 2020 at 1:05 AM Keith Medcalf wrote: > Uck. That is the most horrible looking thing I have ever seen in my > life. Good luck with it. > I truly hope Keith you'll continue making your tremendous contributions to the SQLite community. Things will inevitably move over to the

Re: [sqlite] COALESCE() does not short-circuit sometimes

2020-03-11 Thread Dominique Devienne
On Wed, Mar 11, 2020 at 12:03 PM Justin Ng wrote: > -- Query 3 > SELECT > COALESCE( > (SELECT 'hello'), > ABS(-9223372036854775808) > ); > [...]. It should short-circuit and not evaluate ABS() Interestingly, found this as well: https://github.com/AnyhowStep/tsql/issues/233 SQLite

Re: [sqlite] Status of LSM1 extension

2020-03-05 Thread Dominique Devienne
On Thu, Mar 5, 2020 at 12:35 PM Dan Kennedy wrote: > On 5/3/63 16:11, Dominique Devienne wrote: > > I'm interested in LSM1 [1] as an alternative to SQLite [...] > > [...], I don't think it's too bad of an implementation. The > automated tests are reasonably good - although of

[sqlite] Status of LSM1 extension

2020-03-05 Thread Dominique Devienne
Hi, I'm interested in LSM1 [1] as an alternative to SQLite, since in a particular use-case, I'm using SQLite mostly as a key-value store, and write performance is particularly important, in addition to MVCC. Sounds like it could be an excellent fit here, and the fact it comes from the SQLite team

Re: [sqlite] How to enforce a specific order of group_concat?

2020-03-03 Thread Dominique Devienne
On Mon, Mar 2, 2020 at 6:35 PM Keith Medcalf wrote: > Well, in theory an order by in a nested select means that the result of the > operation is an ordered projection and not merely a set of rows. > For this particular case (a nested select with an order by and the outer > query with an

Re: [sqlite] How to enforce a specific order of group_concat?

2020-03-02 Thread Dominique Devienne
On Mon, Mar 2, 2020 at 5:09 PM Keith Medcalf wrote: > select group_concat(value) from (select distinct value from test order by > value); But is that guaranteed to be ordered correctly "forever" instead of by "happenstance" from current implementation details? My point was that the Window

Re: [sqlite] How to enforce a specific order of group_concat?

2020-03-02 Thread Dominique Devienne
On Sun, Mar 1, 2020 at 10:58 PM mailing lists wrote: > Are there any other solutions / possibilities? I thought someone more knowledgeable than I about Window Functions [1] would answer, but since nobody mentioned them so far, I'll do it, as I believe this is the "SQL native" way to achieve what

Re: [sqlite] CSV import using CLI (header, NULL)

2020-02-29 Thread Dominique Devienne
On Sat, Feb 29, 2020 at 1:42 PM Shawn Wagner wrote: > To import a csv file with headers into an existing table, you can use > .import '| tail -n +2 yourfile.csv' yourtable > to skip the header line. On unix. And by shell’ing out to native tools, so not portable. The cli ought to have something

Re: [sqlite] Error/Result code documentation

2020-02-26 Thread Dominique Devienne
On Wed, Feb 26, 2020 at 11:09 AM Dominique Devienne wrote: > Hi. In the doc excerpt below from https://www.sqlite.org/rescode.html > are the $n*Code variables supposed to be expanded with a numeric > value, and there's a little issue in the doc generation? Thanks, --DD Thanks for the fi

[sqlite] Error/Result code documentation

2020-02-26 Thread Dominique Devienne
Hi. In the doc excerpt below from https://www.sqlite.org/rescode.html are the $n*Code variables supposed to be expanded with a numeric value, and there's a little issue in the doc generation? Thanks, --DD 4. Primary Result Code List The $nPrimCode result codes ... 5. Extended Result Code List

Re: [sqlite] Please increase the default for SQLITE_MAX_VARIABLE_NUMBER

2020-02-13 Thread Dominique Devienne
On Wed, Feb 12, 2020 at 9:02 PM Eric Grange wrote: > [...] This is completely safe vs SQL injection, and IME quite efficient. [...] I disagree that this is efficient enough. I'd much rather have native support in SQLite for array binding, in the public API, than this. That public API could wrap

Re: [sqlite] Does a foreign key field need a separate index?

2020-02-06 Thread Dominique Devienne
On Thu, Feb 6, 2020 at 11:08 PM Simon Slavin wrote: > On 6 Feb 2020, at 9:23pm, Rael Bauer wrote: > > Is a foreign key field automatically indexed, or will it benefit from a > > separately created index? > No indexes for either lookup are automatically created. The shell's .expert command

Re: [sqlite] [EXTERNAL] Re: Patch: VTable Column Affinity Question and Change Request

2020-02-06 Thread Dominique Devienne
On Thu, Feb 6, 2020 at 9:32 AM Hick Gunter wrote: > >Of course, it may be that the writer of the VTable should know what they are > >doing and generate a VTable definition that is consistent with how their > >cursor methods return data, however ... this will omit the OP_Affinity if no >

Re: [sqlite] Check constrain execution timing change? (Now a bug)

2020-02-04 Thread Dominique Devienne
On Tue, Feb 4, 2020 at 5:38 PM Doug wrote: > > You're twisting my point here. I obviously want the reverse, > > I want the database types to "drive" the binding done. 1-to-1. > > Because even if binding a different type would work, via SQLite's > > own implicit conversion, I don't want that,

Re: [sqlite] Check constrain execution timing change? (Now a bug)

2020-02-04 Thread Dominique Devienne
On Mon, Feb 3, 2020 at 6:42 PM James K. Lowden wrote: > Do you want to force applications to "pre-convert" values the DBMS can > convert implicitly? Yes, that's exactly what I want James. I want the enforce the bind-value type to be an exact match for the column value type. I could before, via

Re: [sqlite] Check constrain execution timing change? (Now a bug)

2020-02-03 Thread Dominique Devienne
On Mon, Feb 3, 2020 at 5:35 PM Richard Hipp wrote: > On 2/3/20, Dominique Devienne wrote: > > On Sun, Feb 2, 2020 at 12:50 AM Richard Hipp wrote: > > This is the SQL: > > CREATE TABLE t1(x INT CHECK(typeof(x)=='integer')); > INSERT INTO t1(x) VALUES('123'); &

Re: [sqlite] Check constrain execution timing change? (Now a bug)

2020-02-03 Thread Dominique Devienne
On Sun, Feb 2, 2020 at 12:50 AM Richard Hipp wrote: > On 2/1/20, Thomas Kurz wrote: > > Does this mean there will be no possibility to prevent inserting a string > > into an integer column anymore? > > > > create table x (x integer check (typeof(x) == 'integer')); > > insert into x values

Re: [sqlite] Behavior change around triggers between 3.19 and 3.30

2020-01-30 Thread Dominique Devienne
On Thu, Jan 30, 2020 at 3:38 PM Graham Holden wrote: > Thursday, January 30, 2020, 12:24:40 PM, Dominique Devienne > wrote: > > The strange thing though, is that I can't repro on a small example. > > Despite using not_there in the trigger, and doing DML and ALTER TABLE, >

Re: [sqlite] Behavior change around triggers between 3.19 and 3.30

2020-01-30 Thread Dominique Devienne
On Thu, Jan 30, 2020 at 1:09 PM Richard Hipp wrote: > On 1/30/20, Dominique Devienne wrote: > > My first question would be to ask whether there's a pragma or > > compile-time option to get back to the old behavior? > > Did you try "PRAGMA legacy_alter_table=ON;"?

[sqlite] Behavior change around triggers between 3.19 and 3.30

2020-01-30 Thread Dominique Devienne
BEFORE 3.19.3 2017-06-08 14:26:16 0ee482a1e0eae22e08edc8978c9733a96603d4509645f348ebf55b579e89636b AFTER 3.30.1 2019-10-10 20:19:45 18db032d058f1436ce3dea84081f4ee5a0f2259ad97301d43c426bc7f3dfalt2 Every 18 to 24 months we upgrade SQLite in a large commercial software suite. Such a recent upgrade

Re: [sqlite] New word to replace "serverless"

2020-01-28 Thread Dominique Devienne
On Mon, Jan 27, 2020 at 11:19 PM Richard Hipp wrote: > How can I fix this? What alternative word can I use in place of > "serverless" to mean "without a server"? Don't. I'm with Warren, Jens, Stephen on this one. Keep it, but make a new sqlite.org/serverless doc page, and link to it when you

[sqlite] New uuid extension in amalgamation

2020-01-23 Thread Dominique Devienne
Hi. Looks like 3.31 (congrats on the release) does not include that small extension in the amalgamation. Could it please? Uuids are fairly common in many schemas, so native support "by default" would standardize support for them in the SQLite ecosystem. Thanks, --DD PS: And we'd be able to retire

Re: [sqlite] Find schema of a table in a query

2020-01-19 Thread Dominique Devienne
On Sun, Jan 19, 2020 at 9:47 AM x wrote: > Suppose you’re given a query ‘SELECT 1 from tbl’ by a user and you want to > know the name of the schema that tbl belongs to. What’s the easiest way to > do this? Set an authorizer. Requires to write code though, cannot be done in SQL.

Re: [sqlite] Next Release? Visual release timeline?

2020-01-16 Thread Dominique Devienne
On Wed, Jan 15, 2020 at 4:54 PM R Smith wrote: > On 2020/01/15 1:24 PM, Richard Hipp wrote: > >> (2) Assume the data is a JSON array of pairs. The first element of > >> each pair is the release name (ex: "3.30.0") and the second element is > >> the time as a fractional year (ex: "2019.7775").

[sqlite] Next Release? Visual release timeline?

2020-01-15 Thread Dominique Devienne
I like Lua's way to graphically visualize releases at https://www.lua.org/versions.html Makes it very easy to get a sense of the frequency. Any chance SQLite would do that, perhaps with "major" (excluding the leading 3.) releases on one side, and minor ones on the other? It's been a quarter

Re: [sqlite] Query Planner GROUP BY and HAVING clauses optimization ?

2020-01-14 Thread Dominique Devienne
On Tue, Jan 14, 2020 at 2:57 PM Jean-Baptiste Gardette wrote: > SELECT * FROM t1 GROUP BY a HAVING b > 1; > > Will the GROUP BY clause be supressed and HAVING clause be rewritten in WHERE > clause by the optimizer ? My question would be why you wouldn't write it as a WHERE clause in the first

Re: [sqlite] Best way to store key,value pairs

2020-01-14 Thread Dominique Devienne
On Tue, Jan 14, 2020 at 9:35 AM Wout Mertens wrote: > On Mon, Jan 13, 2020 at 10:45 PM James K. Lowden > This is a trade-off between schema simplicity, storage layout and speed of > some operations. I'd > argue that in this particular case, a JSON field is beneficial for > simplicity, speed

Re: [sqlite] Unexplained table bloat

2020-01-13 Thread Dominique Devienne
On Mon, Jan 13, 2020 at 1:10 PM Keith Medcalf wrote: > If the register object contains "text" and you cast it to a blob (remove the > text affinity) you are left with just the bag-o-bytes, and length() will > return the size of the bag encoded in the register. If the data in the > register is

Re: [sqlite] Unexplained table bloat

2020-01-13 Thread Dominique Devienne
On Mon, Jan 13, 2020 at 11:07 AM Keith Medcalf wrote: > On Monday, 13 January, 2020 02:27, Dominique Devienne > wrote: > >> I'd vote for a lengthof(col) that's always O(1) for both text and blob > > So what should lengthof(something) return the number of bytes in the

Re: [sqlite] Unexplained table bloat

2020-01-13 Thread Dominique Devienne
On Fri, Jan 10, 2020 at 7:03 PM Richard Hipp wrote: > On 1/10/20, Dominique Devienne wrote: > > There's no way at all, to know the length of a text column with embedded > > NULLs? > > You can find the true length of a string in bytes from C-code using > the sqlite3_

Re: [sqlite] Unexplained table bloat

2020-01-10 Thread Dominique Devienne
On Fri, Jan 10, 2020 at 4:30 PM Richard Hipp wrote: > length() on a BLOB should show the number of bytes in the BLOB. > > length() on a string should show the number of *characters* (not > bytes) in the string up through but not including the first > zero-character. It is possible to have

Re: [sqlite] A hang in Sqlite

2020-01-06 Thread Dominique Devienne
On Mon, Jan 6, 2020 at 3:49 PM Domingo Alvarez Duarte wrote: > I understand the original point of view of this thread, but I'm glad > that we have those submissions here because it makes me aware of > people/tools/technics/patterns that can help in other projects. > I completely agree. Yet at

Re: [sqlite] A hang in Sqlite

2020-01-06 Thread Dominique Devienne
On Mon, Jan 6, 2020 at 2:36 PM Jose Isaias Cabrera wrote: > Dominique Devienne, on Monday, January 6, 2020 07:51 AM, wrote... > [...] it's "polluting" a bit this ML. > > This is why we are all so different. I, actually enjoy the "pollution" > because I try

Re: [sqlite] A hang in Sqlite

2020-01-06 Thread Dominique Devienne
On Mon, Jan 6, 2020 at 8:30 AM Dan Kennedy wrote: > On 6/1/63 13:44, Yongheng Chen wrote: > > We found a test case that hangs Sqlite: > > Thanks for all the work you've been doing on SQLite! > Indeed. But... The frequency of all these fuzzer related emails has reached a point IMHO that it's

Re: [sqlite] Performance vs. memory trade-off question

2019-12-16 Thread Dominique Devienne
On Sat, Dec 14, 2019 at 2:27 PM Richard Hipp wrote: > QUESTION: Should this feature be default-on or default-off? > > What's more important to you? 0.25% fewer CPU cycles or about 72KB > less heap space used per database connection? > Backward compatibility. I.e. if I change nothing in my

Re: [sqlite] Securing user supplied SQL statements in a single process

2019-12-12 Thread Dominique Devienne
On Thu, Dec 12, 2019 at 1:47 PM test user wrote: > How can I secure user supplied SQL statements in a single process? > The one mechanism SQLite has is the authorizer [1]. Whether that's good enough for you, that's for you to determine. --DD [1] https://www.sqlite.org/c3ref/set_authorizer.html

Re: [sqlite] Changes in version 3.28.0 makes sql run slower

2019-12-06 Thread Dominique Devienne
On Fri, Dec 6, 2019 at 2:21 PM Richard Hipp wrote: > On 12/6/19, Keith Medcalf wrote: > > > > Perhaps the optimizer could make a "left join" that is not actually an > outer > > join into a "cross join" and preserve the nesting order ... ? > > It could do that, but that would kind of defeat the

Re: [sqlite] Changes in version 3.28.0 makes sql run slower

2019-12-06 Thread Dominique Devienne
On 06.12.2019 10:33, Shawn Wagner wrote: > Does running an ANALYZE have any impact? > On Fri, Dec 6, 2019 at 11:06 AM radovan5 wrote: > Yes it has and I get correct plan. Did not use analyze before or pragma > optimize > but I see I would have to. Thank you for reminding me to this. Just in my

Re: [sqlite] sqlite syntax auto suggest

2019-11-29 Thread Dominique Devienne
On Fri, Nov 29, 2019 at 2:10 PM Richard Hipp wrote: > On 11/29/19, Laurent wrote: > > > > Could you perhaps explain what pos means and what the [isTerminal] = > 0 rows mean. > > New check-in enhances the output to include a comment in the SQL > before the encoding of each production rule. This

[sqlite] built-in printf() not supporting \n or \t ?

2019-11-28 Thread Dominique Devienne
Obviously it's ugly to use concatenation and char() to format a string literal with tabs and newlines. Is there a better way? Why doesn't printf() support newlines and tabs like it's C cousin? --DD PS: Built-in printf() also doesn't support positional params, to "emulate" newline with printf(

Re: [sqlite] Concurrency Question

2019-11-25 Thread Dominique Devienne
On Sat, Nov 23, 2019 at 4:17 PM Dan Kennedy wrote: > > [...] Why is thread_B blocked when doing a read just because SQLite is > writing to another table? [...] > > Is this the expected behavior or am I doing something stupid in my code. > And if so, what to check? > > This should only happen if

Re: [sqlite] Using application_id

2019-11-19 Thread Dominique Devienne
On Tue, Nov 19, 2019 at 2:00 AM Peter da Silva wrote: > > > If you stick to lower or upper case letters, could encode up to 6 chars > in the app_id. --DD > > The return of RADIX-50. > > https://en.wikipedia.org/wiki/DEC_Radix-50 Thanks! I might go with this going forward. --DD PS: I tend to

Re: [sqlite] Using application_id

2019-11-18 Thread Dominique Devienne
On Mon, Nov 18, 2019 at 2:41 PM Clemens Ladisch wrote: > Tobias Leupold wrote: > Apparently, authors or 'private' file formats do not bother to register > their IDs. > Indeed, there's little point, as those are rarely "public". I tend to chose a 4 letter prefix related to the kind of

Re: [sqlite] Official Github Mirror? Of the Amalgamation?

2019-11-18 Thread Dominique Devienne
On Mon, Nov 18, 2019 at 10:41 AM Shawn Wagner wrote: > There is an official github mirror of the fossil repository: > https://github.com/sqlite/sqlite Thanks. I thought there was one, but search below didn't find it: https://www.google.com/search?q=sqlite+github+official+mirror It's weird the

Re: [sqlite] Relax "DISTINCT aggregates" error

2019-11-18 Thread Dominique Devienne
On Fri, Nov 15, 2019 at 4:22 PM Jose Isaias Cabrera wrote: > Dominique Devienne, on Friday, November 15, 2019 09:02 AM, wrote... > > Have you tried this, > sqlite> select group_concat(distinct id || ', ') from t; > 1, ,2, ,4, ,7, > > The only problem is that when the

[sqlite] Official Github Mirror? Of the Amalgamation?

2019-11-18 Thread Dominique Devienne
In searches, https://github.com/mackyle/sqlite comes up first, but given that Fossil has good/better interop with GIT these days, why not an official mirror? Also, mirrors are for the normal repo, while ability to refer to an amalgamation in one's project by directly linking to it via a GIT

[sqlite] Relax "DISTINCT aggregates" error

2019-11-15 Thread Dominique Devienne
As can be seen below, the last query fail, despite the one before it succeeding. Yet the second argument is constant, thus it would seem "natural" for it to work as well. Could the error be "relaxed", when the non-first argument(s) to aggregate functions are constant? Thanks, --DD

Re: [sqlite] SQLITE_DETERMINISTIC and custom function optimization

2019-11-14 Thread Dominique Devienne
On Sat, Nov 9, 2019 at 1:20 PM Mario M. Westphal wrote: > Thanks to all the friendly people who commented on my question. Much > appreciated :-) > > I was able to solve this with a small trick: > I created a small 'state' struct with a rowid and the result (float) for > that row. > Sounds like

Re: [sqlite] SQLITE_DETERMINISTIC and custom function optimization

2019-11-14 Thread Dominique Devienne
On Fri, Nov 8, 2019 at 9:20 PM Keith Medcalf wrote: > [...] The optimizer is prone to calculating things more often than it > needs to, and is difficult to force to "materialize" things. Since your expensive function needs to be calculated for every row of the > table anyway, it would be better

Re: [sqlite] SQLite with branching

2019-11-05 Thread Dominique Devienne
On Tue, Nov 5, 2019 at 10:01 AM Wout Mertens wrote: > On Mon, Nov 4, 2019 at 10:26 PM Jens Alfke wrote: > > > I don't have a practical use for the branching features, though they're > cool, but I'm salivating at the thought of a 2x speedup. > > With all the work that's put into eking out small

Re: [sqlite] DELETE extremely slow

2019-10-31 Thread Dominique Devienne
On Thu, Oct 31, 2019 at 4:10 PM Thomas Kurz wrote: > Yes, but I'd expect that MariaDB has to do the same, but takes clearly > less than 1 minute instead of 88 minutes... :confused: > Are we comparing apples to oranges here? SQLite runs on the local machine. While MariaDB is client-server, so

Re: [sqlite] DELETE extremely slow

2019-10-31 Thread Dominique Devienne
On Thu, Oct 31, 2019 at 10:57 AM Thomas Kurz wrote: > I'm using a database with 5 hierarchically strcutured tables using foreign > keys. The largest table contains about 230'000 entries. My problem is that > deleting in this database is extremely slow: > > pragma foreign_keys=on; > pragma

Re: [sqlite] Generated columns in primary keys, indexes, and constraints

2019-10-31 Thread Dominique Devienne
On Wed, Oct 30, 2019 at 11:12 AM Richard Hipp wrote: > [...] But using a VIRTUAL generated column as a PRIMARY KEY would be an > issue. > FWIW, I depend on this feature in Oracle, and it works. Both my PRIMARY and FOREIGN keys are VIRTUAL columns, which combine two stored columns. Oracle even

Re: [sqlite] Minor Change Request: CURRENT_* functions also have SQLITE_FUNC_CONSTANT ?

2019-10-30 Thread Dominique Devienne
On Wed, Oct 30, 2019 at 11:26 AM Richard Hipp wrote: > On 10/29/19, Keith Medcalf wrote: > > > > Before you change anything, I think that is incorrect for the various > > datetime functions. I think they SHOULD be permitted in CHECK > constraints > > and in generated always columns, whether

Re: [sqlite] Minor Change Request: CURRENT_* functions also have SQLITE_FUNC_CONSTANT ?

2019-10-30 Thread Dominique Devienne
On Wed, Oct 30, 2019 at 11:26 AM Richard Hipp wrote: > On 10/29/19, Keith Medcalf wrote: > > > > Before you change anything, I think that is incorrect for the various > > datetime functions. I think they SHOULD be permitted in CHECK > constraints > > and in generated always columns, whether

Re: [sqlite] Minor Change Request: CURRENT_* functions also have SQLITE_FUNC_CONSTANT ?

2019-10-30 Thread Dominique Devienne
On Wed, Oct 30, 2019 at 8:32 AM Keith Medcalf wrote: > On Tuesday, 29 October, 2019 23:05, Simon Slavin > wrote: > >On 30 Oct 2019, at 3:58am, Keith Medcalf wrote: > > >> Before you change anything, I think that is incorrect for the various > >> datetime functions. I think they SHOULD be

Re: [sqlite] Backward compatibility

2019-10-29 Thread Dominique Devienne
On Tue, Oct 29, 2019 at 8:38 AM Thomas Kurz wrote: > We recently had a discussion about date/time support, but also other > suggestions, which sooner or later end up at the point "cannot be done, > would break backward compatibility". (See also: "Backward compatibility vs. > new features (was:

Re: [sqlite] Conflict between snapshots and checkpoints

2019-09-30 Thread Dominique Devienne
On Mon, Sep 30, 2019 at 2:07 PM Keith Medcalf wrote: > On Monday, 30 September, 2019 02:06, Dominique Devienne < > ddevie...@gmail.com> wrote: > >On Sun, Sep 29, 2019 at 2:13 PM Keith Medcalf > wrote: > >> On Sunday, 29 September, 2019 01:28, Gwendal Roué <

Re: [sqlite] Conflict between snapshots and checkpoints

2019-09-30 Thread Dominique Devienne
On Sun, Sep 29, 2019 at 2:13 PM Keith Medcalf wrote: > On Sunday, 29 September, 2019 01:28, Gwendal Roué > wrote: > >Those N reader connections allow concurrent database reads. Those "reads" > are > >generally wrapped in a deferred transaction which provides snapshot > >isolation. > > No, it

Re: [sqlite] [EXTERNAL] Group-by and order-by-desc does not work as expected

2019-09-23 Thread Dominique Devienne
On Sat, Sep 21, 2019 at 10:17 PM Fredrik Larsen wrote: > [...] But fixing issues in less than a day of reporting? [...] > That's not unusual at all for SQLite. Either it gets "fixed" quickly, or it doesn't. The hard part is making the case with Richard (and Dan) about the merit of the change,

Re: [sqlite] [EXTERNAL] Group-by and order-by-desc does not work as expected

2019-09-20 Thread Dominique Devienne
On Fri, Sep 20, 2019 at 12:33 PM Hick Gunter wrote: > The dialogue from the stackoverflow discussion shows this quite clearly. > Shows what clearly Gunter? I'm not sure to follow. I've read the SO post, and I don't get your point. We can observe GROUP BY works ASCending only as of now. Why it

Re: [sqlite] [EXTERNAL] Group-by and order-by-desc does not work as expected

2019-09-20 Thread Dominique Devienne
On Thu, Sep 19, 2019 at 6:15 PM Hick Gunter wrote: > -Ursprüngliche Nachricht- > Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > Im Auftrag von Fredrik Larsen > Gesendet: Donnerstag, 19. September 2019 17:29 > An: SQLite mailing list > Betreff: Re: [sqlite]

Re: [sqlite] Undo sqlite3_snapshot_open?

2019-09-19 Thread Dominique Devienne
On Thu, Sep 19, 2019 at 1:13 PM Gwendal Roué wrote: > I am looking at the snapshot experimental APIs > How long do experimental APIs remain experimental? Snapshot is over 3.75 years old now. Will it ever graduate to a fully supported API? As far as I understood the doc, a snapshot remains

Re: [sqlite] The best way to check if a file is a sqlite3 DB file?

2019-09-19 Thread Dominique Devienne
On Thu, Sep 19, 2019 at 10:20 AM Rowan Worth wrote: > On Thu, 19 Sep 2019 at 16:03, Dominique Devienne > > On Wed, Sep 18, 2019 at 6:43 PM Clemens Ladisch > > > Peng Yu wrote: > > > > Is there a better way to just return an exit status of 0 for > > &

Re: [sqlite] The best way to check if a file is a sqlite3 DB file?

2019-09-19 Thread Dominique Devienne
On Wed, Sep 18, 2019 at 6:43 PM Clemens Ladisch wrote: > Peng Yu wrote: > > Is there a better way to just return an exit status of 0 for > > a sqlite3 DB file and 1 otherwise? > > Extract the magic header string from a known DB file: > > dd bs=16 count=1 < some.db > sqlite3-signature > > Then

Re: [sqlite] [EXTERNAL] Re: insert: how to force application to provide value for int primary key?

2019-09-10 Thread Dominique Devienne
On Tue, Sep 10, 2019 at 5:07 PM Hick Gunter wrote: > So it really depends on the order of adding records more than the presence > or absence of a rowid. > True. I'm making the conjecture that w/ rowid tables tend to be ordered (via implicit or explicit integer auto-increment rowids), while w/o

Re: [sqlite] Why aren't there date/time parsing built-in functions in SQLite

2019-09-10 Thread Dominique Devienne
On Tue, Sep 10, 2019 at 4:35 PM Igor Tandetnik wrote: > On 9/10/2019 7:05 AM, Keith Medcalf wrote: > > select value, > > round((julianday(value) - julianday('00:00:00')) * 86400.0, 3) > >from test; > > Another possibility: strftime('%s', '1970-01-01 ' || value) > I ended up needing

Re: [sqlite] insert: how to force application to provide value for int primary key?

2019-09-10 Thread Dominique Devienne
On Tue, Sep 10, 2019 at 4:32 PM R Smith wrote: > > So "fat" tables, with large rows, and lost of inserts/updates, is > basically > > the worse case > > scenario for such WITHOUT ROWID tables. It works, no issue there, and as > > typical of > > SQLite is often fast enough for most DB sizes, but

Re: [sqlite] insert: how to force application to provide value for int primary key?

2019-09-10 Thread Dominique Devienne
On Tue, Sep 10, 2019 at 2:09 PM Marek Wieckowski wrote: > Yes, indeed works. Great, thank you! > Note though that it has performance implications perhaps. This changes to physical structure of the table, to be stored as an index basically. So if you do lots of insertions "in the middle", you

Re: [sqlite] insert: how to force application to provide value for int primary key?

2019-09-10 Thread Dominique Devienne
On Tue, Sep 10, 2019 at 2:20 PM Jose Isaias Cabrera wrote: > Marek Wieckowski, on Tuesday, September 10, 2019 08:08 AM, wrote... > > > Make it a WITHOUT ROWID table: > > > > > > CREATE TABLE example_table ( > > >id INTEGER PRIMARY KEY, > > >description TEXT NOT NULL > > >

Re: [sqlite] FW: Why aren't there date/time parsing built-in functions in SQLite

2019-09-10 Thread Dominique Devienne
On Tue, Sep 10, 2019 at 1:27 PM Keith Medcalf wrote: > Also, note that you have to use the 'unixepoch' modifier with the time > function so that it knows the value is seconds, not days, since floats are by default days and integers are by default > seconds. [...] In my quick reading of the

Re: [sqlite] Why aren't there date/time parsing built-in functions in SQLite

2019-09-10 Thread Dominique Devienne
On Tue, Sep 10, 2019 at 1:05 PM Keith Medcalf wrote: > insert into test values ('00:00:07.86'); > select value, >round((julianday(value) - julianday('00:00:00')) * 86400.0, 3) > from test; > Thanks! As I guessed, I was indeed missing something. But IMHO that something is definitely

[sqlite] Enhancement request: scanf built-in function

2019-09-10 Thread Dominique Devienne
In the same vein as my previous post about lack of function acting as the "opposite" of strftime(), I'm wondering if it's not time to have a scanf() function as the opposite of printf(). In the olden days, SQLite didn't have table-valued eponymous-vtable "functions", so there was a technical

[sqlite] Why aren't there date/time parsing built-in functions in SQLite

2019-09-10 Thread Dominique Devienne
Hi, There are functions to format numbers as text times and/or dates, but I can't find equivalent ones to parse those text times/dates back to numbers. I wanted to sum durations expressed as HH:MM:SS.SS strings, and I was expecting a function parsing such a string into a number of seconds for

Re: [sqlite] INSERT vs BEGIN

2019-09-03 Thread Dominique Devienne
On Tue, Sep 3, 2019 at 12:03 PM Rob Richardson wrote: > I didn't know it is possible to insert multiple rows into a table using a > command like this. Added over 7 years ago: See https://www.sqlite.org/changes.html#version_3_7_11 #1 > Is this just an SQLite feature, or is this part of the

Re: [sqlite] INSERT vs BEGIN

2019-09-02 Thread Dominique Devienne
On Mon, Sep 2, 2019 at 12:52 PM Simon Slavin wrote: > > One must know that I am obliged to use "BEGIN DEFERRED TRANSACTION" > because others threads needs to access to tables. > SQLite copes very well when you have one connection writing to the > database and other connections reading. The

Re: [sqlite] INSERT vs BEGIN

2019-09-02 Thread Dominique Devienne
On Mon, Sep 2, 2019 at 12:04 PM Grincheux <51...@protonmail.ch> wrote: > What is the best ? > > INSERT INTO artists (name) VALUES > ("Gene Vincent") ... > ("Moi _ Me"); > You're missing commas. And you should not use double-quotes but single-quotes for string-literals. > I want to insert 1 000

Re: [sqlite] [EXTERNAL] char(0) with SQLite

2019-09-02 Thread Dominique Devienne
On Mon, Sep 2, 2019 at 12:12 PM Hick Gunter wrote: > Dimensions are ignored by SQLite. A field defined CHAR(0) can hold any > length (up to the internal limit) of string. SQlite will only store the > actual length of the string plus its contents, no space is wasted. And Gunter wrote "string"

Re: [sqlite] [EXTERNAL] Re: http://roaringbitmap.org/

2019-09-02 Thread Dominique Devienne
On Mon, Sep 2, 2019 at 12:08 PM Hick Gunter wrote: > Back in 2011 I implemented a virtual table using the "fastbit" library by > John Wu of the Lawrence Berekely National Laboratory. This allowed selects > of the form > > SELECT ... FROM WHERE rowid IN (SELECT rowid FROM > WHERE ); > Did it

Re: [sqlite] http://roaringbitmap.org/

2019-09-02 Thread Dominique Devienne
On Mon, Sep 2, 2019 at 8:06 AM Robert M. Münch wrote: > Hi, I think that SQLite use some bitmap indexes Not that I know of, but I don't know the full source code. Maybe FTS[345] do/es, but SQLite itself only uses BTree-indexes AFAIK. > and this here might be of interest if not already

Re: [sqlite] Tracking item history using SQLite

2019-09-02 Thread Dominique Devienne
On Sat, Aug 31, 2019 at 12:24 PM Rob Willett wrote: > 5. SQLite seems to be able to do anything we want it to. [...] > Other people seem worried about the 'lack' of some datatypes, we do > masses of data and date conversations as needed and it's never been a > speed issue or any issue. (since

Re: [sqlite] dqlite 1.0.0 - SQLite replication and failover library

2019-08-29 Thread Dominique Devienne
On Thu, Aug 29, 2019 at 2:35 PM Jose Isaias Cabrera wrote: > Free Ekanayaka, on Thursday, August 29, 2019 06:40 AM, wrote... > > See https://dqlite.io for more details. > > Can dsqlite be installed on Windows? I went to the site, read the > README.md file, and could not find any reference of

Re: [sqlite] strip off file metadata in sqlar

2019-08-28 Thread Dominique Devienne
On Tue, Aug 27, 2019 at 11:46 PM Peng Yu wrote: > I just need the return status of sqldiff (as `cmp -s`). Is there an > option to suppress all the screen output? Thanks. > https://www.sqlite.org/cgi/src/artifact/7b9b7238284f0213 Doesn't look like it does. But redirecting to /dev/null or NUL

Re: [sqlite] database like file archive

2019-08-27 Thread Dominique Devienne
https://sqlite.org/sqlar/doc/trunk/README.md On Tue, Aug 27, 2019 at 3:57 PM Peng Yu wrote: > Hi, > > I haven't found an archive format that allows in-place delete (I know > that .zip, .7z and .tar don't). This means that whenever delete is > needed, the original archive must be copied first.

Re: [sqlite] Query for Many to Many

2019-08-27 Thread Dominique Devienne
On Tue, Aug 27, 2019 at 4:00 PM Dominique Devienne wrote: > select author.*, books.* > from author_books > join author on author.author_id = author_books.author_id > join books on books.book_isbn = author_books.book_isbn > Which can also be written: select author.*,

Re: [sqlite] Query for Many to Many

2019-08-27 Thread Dominique Devienne
On Tue, Aug 27, 2019 at 3:38 PM dboland9 wrote: > I need some help writing some queries for a MTM relationship. The example > tables are: > > author table books table author_books table > author_id PKbook_isbn PKa_b_id PK > author_fnamebook_title

Re: [sqlite] Backward compatibility vs. new features (was: Re: dates, times and R)

2019-08-13 Thread Dominique Devienne
On Tue, Aug 13, 2019 at 10:58 AM Ling, Andy wrote: > > This is what I would call "forward compatibility": You expect an old > application > > to be able to read file formats of a future version. Do you have an > example > > where there is really required? > > I have an Android app that lets you

[sqlite] Enhance CLI with ability to assert version and compile option of sqlite3.so/.dll

2019-08-07 Thread Dominique Devienne
Hi Richard, and others, A neat little program with added in the context of Fossil SCM, which asserts the version of the SQLite library used, and which compile time option were used to compile it (statically or not, for that matter). See https://fossil-scm.org/fossil/info/350c627a52908458 I

Re: [sqlite] Doc about sqlite_master

2019-08-05 Thread Dominique Devienne
On Mon, Aug 5, 2019 at 2:03 PM Simon Slavin wrote: > On 5 Aug 2019, at 11:54am, Dominique Devienne wrote: > > > What other sqlite_* tables are you talking about? > > sqlite_master is AFAIK the only table with a "fixed-name", that's part > of the "public API&q

Re: [sqlite] Doc about sqlite_master

2019-08-05 Thread Dominique Devienne
On Mon, Aug 5, 2019 at 11:37 AM Simon Slavin wrote: > On 5 Aug 2019, at 10:34am, Dominique Devienne wrote: > > > Thus my suggestion that an explicit page of its own is > warranted, properly indexed then. > Given that there are other sqlite_* tables which are documented, per

Re: [sqlite] Doc about sqlite_master

2019-08-05 Thread Dominique Devienne
On Mon, Aug 5, 2019 at 10:37 AM Simon Slavin wrote: > On 5 Aug 2019, at 9:25am, Dominique Devienne wrote: > < > https://www.sqlite.org/fileformat2.html#storage_of_the_sql_database_schema > > > <https://sqlite.org/faq.html#q7> > I think the first of those could

[sqlite] Information Schema enhancement request

2019-08-05 Thread Dominique Devienne
(Not sure it's strictly information schema related, but here goes anyway). SQLite has grown in the recent months better support for extracting an information schema, thanks to new pragmas and especially their eponymous vtable versions, allowing them to be mixed in queries with sqlite_master. But

[sqlite] Doc about sqlite_master

2019-08-05 Thread Dominique Devienne
First, is sqlite_master part of the "public API" of SQLite? I would think so, since many example refer to it. I was thus looking for a Doc page about it, but a quick Google search didn't turn up a "direct" result. For example, the values sqlite_master.type can take, I found only outside

Re: [sqlite] [EXTERNAL] storing blobs in a separate table

2019-08-01 Thread Dominique Devienne
On Thu, Aug 1, 2019 at 5:44 PM Jens Alfke wrote: > > On Jul 31, 2019, at 5:02 AM, Hick Gunter wrote: > > SQLite stores rows in a compressed format that requires decoding. To > access the nth field, all the fields that come before it need to be decoded. > > My understanding is that it’s just a

Re: [sqlite] Large database backup

2019-08-01 Thread Dominique Devienne
On Thu, Aug 1, 2019 at 5:02 PM Olivier Mascia wrote: > > Le 1 août 2019 à 14:49, Tammisalo Toni a > écrit : > > I have an application which is using sqlite database in WAL mode. There > is a need for > > periodic backups to a remote site without obstructing the normal > operation. Both read > >

Re: [sqlite] Double CTRL-C in shell get you completely out

2019-08-01 Thread Dominique Devienne
On Wed, Jul 31, 2019 at 8:37 PM Tony Papadimitriou wrote: > Recently CTRL-C was improved to abort the query and stay in the CLI. This > is very good. > FWIW, SQliteSpy uses the escape key (ESC) to abort a run-away query (Hello incorrect recursive CTE!) I'd prefer CTRL-C to keep killing the

Re: [sqlite] [EXTERNAL] Re: Estimated Costs and Memory DBs

2019-07-24 Thread Dominique Devienne
On Wed, Jul 24, 2019 at 3:09 PM Hick Gunter wrote: > With the current interface, the xBestIndex function has the possibility of > returning "effort" and "result set size" separately, instead of just an > aggregate "effort" (which was at the time documented to assume "result set > size"). >

Re: [sqlite] [EXTERNAL] Re: Estimated Costs and Memory DBs

2019-07-24 Thread Dominique Devienne
On Wed, Jul 24, 2019 at 10:45 AM Hick Gunter wrote: > The speed of a virtual table depends on the backing store and software > used to implement it. > [DD] Sure. virtual-tables can also access the disk and do expensive things. [DD] I did say "example given" for my fast-pure-memory-no-decoding

  1   2   3   4   5   6   7   8   >