Re: [sqlite] UPDATE statement without FROM clause

2016-06-06 Thread James K. Lowden
On Sat, 4 Jun 2016 18:18:36 +0200 skywind mailing lists wrote: > At the moment I have to run something like: > > UPDATE A SET item1=(SELECT B.item FROM B WHERE B.ID=A.ID),... > itemN=... WHERE EXISTS (SELECT 1 FROM B WHERE B.ID=A.ID); > > Using a FROM clause I just

Re: [sqlite] SQL / SQLite for Beginners

2016-06-06 Thread James K. Lowden
On Thu, 26 May 2016 10:54:30 -0400 r.a.n...@gmail.com wrote: > FWIW, since it's inception, S.Q.L has been pronounced allot like > CICS. This may be more true than you know. It's not too hard to find old-timers who pronounce it "kicks". --jkl ___

Re: [sqlite] Is there equivalent to MySQL IF() function?

2014-10-07 Thread James K. Lowden
On Tue, 7 Oct 2014 12:15:09 +0300 "Tony Papadimitriou" wrote: > Is there any an equivalent function to the MySQL > IF(condition,true_expr,false_expr) function? > > For example, SELECT AGE,IF(AGE < 3,"BABY",IF(AGE < > 18,"CHILD","ADULT")); > > If not, please add to wish list :)

Re: [sqlite] Detecting multiple CHECK failures

2014-10-08 Thread James K. Lowden
On Wed, 08 Oct 2014 15:01:39 +0200 Clemens Ladisch wrote: > SQL constraints were designed to catch _programming_ errors, not > _user_ errors. Neither and both, actually. Database theory doesn't distinguish between different sources of invalid input. Constraints enforce

Re: [sqlite] Possible automatic ON CONFLICT resolution via DEFAULTS

2014-10-08 Thread James K. Lowden
On Wed, 8 Oct 2014 00:14:51 -0400 Stephen Chrzanowski wrote: > When adding a NULL value to a table that has the NOT NULL flag set on > that field, instead of raising an exception, if the field definition > were to have the word "USE" between "ON CONFLICT" and "DEFAULT" in >

Re: [sqlite] Possible automatic ON CONFLICT resolution via DEFAULTS

2014-10-10 Thread James K. Lowden
On Thu, 9 Oct 2014 11:16:25 -0400 Stephen Chrzanowski <pontia...@gmail.com> wrote: > On Wed, Oct 8, 2014 at 8:38 PM, James K. Lowden > <jklow...@schemamania.org> wrote: > > > > > The problem I see with your suggestion is that I can't think of > >

Re: [sqlite] Make a database read-only?

2014-10-15 Thread James K. Lowden
On Tue, 14 Oct 2014 18:21:27 -0400 Ross Altman wrote: > Yeah, that's actually a really good point. Oh well, I guess I'll just > have to hope that people decide to use the database responsibly... > haha You can advertise your database with the tagline, "Please compute

Re: [sqlite] Search query alternatives.

2014-10-17 Thread James K. Lowden
On Thu, 16 Oct 2014 09:05:51 +1100 Michael Falconer wrote: > we just wonder if there is a better way to perform this search in > SQL. Is there a general technique which is superior either in speed, > efficiency or load bearing contexts? The simple answer is No,

Re: [sqlite] unicode case insensitive

2014-10-24 Thread James K. Lowden
On Fri, 24 Oct 2014 21:44:50 +0400 dd wrote: > >>Convert everything to upper (or lower) case brute force. >Sorry. I am not clear. Can you please elaborate this. The standard function tolower(3) is locale-dependent. If your locale is set to match the data's

Re: [sqlite] Finding second occurrence of character in string

2014-10-26 Thread James K. Lowden
On Sun, 26 Oct 2014 15:27:24 +0300 Baruch Burstein wrote: > I need to get the path with the > first 2 parts stripped off. Currently I am doing: > > substr(path, 4+instr(substr(path,4),'/')) > > But that seems long and probably inefficient. > What is the

Re: [sqlite] Keeping -wal and -shm files

2014-10-27 Thread James K. Lowden
On Mon, 27 Oct 2014 12:33:59 +0100 Steinar Midtskogen wrote: > Is there a way to prevent the -wal and -shm files from being deleted > after use, so that I can have them always have the right group? Or is > there a way to tell Linux to observe the setgid flag on a

Re: [sqlite] quasi-bug related to locking, and attached databases....

2014-10-27 Thread James K. Lowden
On Mon, 27 Oct 2014 16:49:42 -0500 Nico Williams wrote: > If it's not too much to ask for then SQLite3 ought to: a) check for > duplicates by canonicalized path (but keep in mind that this can be > difficult to do portably, or without obnoxious length limitations on >

Re: [sqlite] Keeping -wal and -shm files

2014-10-28 Thread James K. Lowden
On Mon, 27 Oct 2014 17:41:53 +0100 Steinar Midtskogen <stei...@latinitas.org> wrote: > "James K. Lowden" <jklow...@schemamania.org> writes: > > > See -o grpid in mount(8). I think that's what you want. > > Thanks. It works! Hmm, I'm glad, but as D

Re: [sqlite] Clarification on sqlite handling of mixed aggregate and non-aggregate columns

2014-10-29 Thread James K. Lowden
On Wed, 29 Oct 2014 20:38:07 +0200 Baruch Burstein wrote: > If I have a table, "t", with 2 columns, "a" and "b". Assuming that > "a" is a unique number, will the following query always return the > whole row (that is, with the correct "b" column) where "a" is the > highest

Re: [sqlite] man page bug

2014-10-31 Thread James K. Lowden
On Thu, 30 Oct 2014 17:37:54 +0100 (CET) Carsten Kunze wrote: > the man page sqlite3.1 contains the .cc request which is not > compatible with the man macro package (and hence must not be used in > a man page). The below patch rectifies that problem and clears up some

Re: [sqlite] Index without backing table

2014-11-01 Thread James K. Lowden
On Sat, 01 Nov 2014 11:06:51 +0200 Paul wrote: > Would be nice to have ability to store both key and payload in the > index. (Let's call it index-only table) > This could be a feature that sets some limitations on a table, like > being unable to have more than one index or

Re: [sqlite] Index without backing table

2014-11-03 Thread James K. Lowden
On Mon, 03 Nov 2014 11:50:17 +0200 Paul wrote: > > > Would be nice to have ability to store both key and payload in the > > > index. (Let's call it index-only table) > > > This could be a feature that sets some limitations on a table, > > > like being unable to have more than one

Re: [sqlite] sqlite3.8.7 crashes when creating an index with WAL mode disabled

2014-11-04 Thread James K. Lowden
On Tue, 4 Nov 2014 12:06:35 + Simon Davies wrote: > > And watch as it crashes when creating the index. > > From https://www.sqlite.org/compile.html: > > Important Note: The SQLITE_OMIT_* options do not work with the > amalgamation or with pre-packaged C code

Re: [sqlite] x64 vs x32 DLL

2014-11-04 Thread James K. Lowden
On Tue, 04 Nov 2014 22:20:23 +0200 RSmith wrote: > The best way to think of the 64 bit upgrade in normal programming is: > "Able to do larger accuracy calculations at more or less the same > speed". Eh, more accurate how? Every 32-architecture I compiled for supported

Re: [sqlite] How to check if a record exists

2014-11-04 Thread James K. Lowden
On Tue, 4 Nov 2014 21:47:20 + "Drago, William @ CSG - NARDAEAST" wrote: > I've been pulling my hair out trying to figure how to use EXISTS. I have several examples at http://www.schemamania.org/sql/#missing.table. > Is there a better/recommended way in SQLite to

Re: [sqlite] LEFT joins affect query plan for semantically equal queries

2014-11-05 Thread James K. Lowden
On Wed, 05 Nov 2014 08:24:47 -0700 "Keith Medcalf" wrote: > The two queries are different. They may end up with the same result, > but you are asking different questions. In the first you are > returning only matching rows. In the later you are requesting a > projection

Re: [sqlite] Does using e.g. LTRIM function remove collation?

2014-11-07 Thread James K. Lowden
On Thu, 6 Nov 2014 17:02:26 -0500 Richard Hipp wrote: > > sqlite> INSERT INTO test VALUES ('b'), ('A'), ('B'), ('a'); > > sqlite> SELECT * FROM test; > > b > > A > > B > > a ... > > sqlite> SELECT * FROM test WHERE LTRIM(col)<'b'; > > A > > B > > A ... > Works as designed. See

Re: [sqlite] What is the best alternative to this RIGHT OUTER JOIN ?

2014-11-08 Thread James K. Lowden
On Sat, 08 Nov 2014 22:55:46 +0900 Tristan Van Berkom wrote: > So I would have to say, the "right way to do it" is the most efficient > way, the one which provides SQLite with the best indications of how > to plot an efficient query plan. Keith is suggesting that the

Re: [sqlite] What is the best alternative to this RIGHT OUTER JOIN ?

2014-11-08 Thread James K. Lowden
On Sun, 09 Nov 2014 00:45:16 +0900 Tristan Van Berkom wrote: > While I do understand SQL as a functional language, most functional > programming I've done still has rather explicit syntax/rules, so I get > particularly uncomfortable with writing vague statements, such

Re: [sqlite] Does using e.g. LTRIM function remove collation?

2014-11-10 Thread James K. Lowden
; > sqlite> SELECT * FROM test WHERE LTRIM(col)<'b'; > > A > > B > > A --jkl > > -Ursprüngliche Nachricht- > Von: James K. Lowden [mailto:jklow...@schemamania.org] > Gesendet: Samstag, 08. November 2014 01:52 > An: sqlite-users@sqlite.org

Re: [sqlite] Triggers and CTE's

2014-11-12 Thread James K. Lowden
On Tue, 11 Nov 2014 17:15:53 -0600 Ben Newberg wrote: > CREATE TRIGGER t_populate_zweeks > AFTER UPDATE ON zSPs WHEN new.Procedure = 6 AND new.Flag = 1 > BEGIN > DELETE FROM zWeeks; > WITH RECURSIVE Weeks(wk) as (select 1 union all select wk + 1 from > Weeks limit 10) >

Re: [sqlite] [SQLite] Support for 23,10 Precision number format

2014-11-13 Thread James K. Lowden
On Thu, 13 Nov 2014 14:38:10 + Simon Slavin wrote: > In summary, if you need ultimate precision, use integers. If not, > use 64-bit IEEE-571 like everyone else does without being sued. If > you somehow really need 23,10 maths, then you're going to have to > write your

Re: [sqlite] Column name as a variable

2014-11-17 Thread James K. Lowden
On Mon, 17 Nov 2014 12:00:06 + Hick Gunter wrote: > SELECT table_name FROM sqlite_master; > > And then, in your programming language of choice, execute Or, with some determination, you can do it in two steps in pure SQL: Use SQL to produce SQL, and execute the result,

Re: [sqlite] Column name as a variable

2014-11-20 Thread James K. Lowden
On Tue, 18 Nov 2014 12:06:02 + Simon Slavin wrote: > > my requirement, which is using a > > table name as a variable > > This is deliberately made very difficult in SQL. I think it's for > security reasons. That may be part of it, but It's really all about values.

Re: [sqlite] Using Sqlite3 as a Change Time Recording Data Store in Glusterfs

2014-11-22 Thread James K. Lowden
On Fri, 21 Nov 2014 14:01:39 -0500 (EST) Joseph Fernandes wrote: > 4) Therefore, we are looking at a datastore that can give us a very > quick write(almost zero latency, as the recording is done inline > w.r.t file IO) and that as good data querying facilities(Slight >

Re: [sqlite] Using Sqlite3 as a Change Time Recording Data Store in Glusterfs

2014-11-23 Thread James K. Lowden
On Sat, 22 Nov 2014 23:25:16 -0500 (EST) Joseph Fernandes wrote: > 2) Using the changelog to feed the db has another issue i.e freshness > of data in the DB w.r.t the IO. Few of our data maintainer scanners > would require the freshness of the feed to be close to real. [...]

Re: [sqlite] Implementing per-value custom types

2014-11-26 Thread James K. Lowden
Darko, I have rather a long answer for you. I'm not confused about the difference between logical and physical types, but I am confused about what you meant and what you're hoping to accomplish. On Wed, 26 Nov 2014 03:22:03 -0800 Darko Volaric wrote: > A 64 bit floating

Re: [sqlite] Bug report: USBAN failure

2014-12-02 Thread James K. Lowden
On Tue, 02 Dec 2014 15:58:47 +0100 Abramo Bagnara wrote: > The point is not about overzealousness, but about the declaration of > memcpy/memset on your machine. > > If it contains the nonnull attribute then (correctly) UBSan detect > that such constraint is not

Re: [sqlite] Bug report: USBAN failure

2014-12-03 Thread James K. Lowden
On Wed, 03 Dec 2014 08:56:44 +0100 Clemens Ladisch <clem...@ladisch.de> wrote: > James K. Lowden wrote: > > /* Copy N bytes of SRC to DEST. */ > > extern void *memcpy (void *__restrict __dest, > > __const void *__restrict __src, size_t __n) > &

Re: [sqlite] sqlite bugreport : unique index causes valid updates to fail

2014-12-09 Thread James K. Lowden
On Mon, 08 Dec 2014 22:01:15 +0700 Dan Kennedy wrote: > On 12/08/2014 09:55 PM, Nico Williams wrote: > > Ideally there would be something like DEFERRED foreign key checking > > for uniqueness constraints... > > You could hack SQLite to do enforce unique constraints the

Re: [sqlite] sqlite bugreport : unique index causes valid updates to fail

2014-12-09 Thread James K. Lowden
On Mon, 08 Dec 2014 15:48:41 +0200 RSmith wrote: > > UPDATE pages SET position = position + 1 WHERE book_id = 0 AND > > position >= 1; > > NOT a bug... the moment you SET position to position +1 for the > first iteration of the query, it tries to make that entry look like >

Re: [sqlite] How do I update multiple rows in a single sql statement

2014-12-09 Thread James K. Lowden
On Mon, 08 Dec 2014 20:57:00 -0500 Igor Tandetnik wrote: > Yes, there are workarounds (a view; or REPLACE INTO may sometimes be > pressed into service). But I, for one, kinda miss UPDATE ... FROM. Be careful what you wish for. :-) The only implementation of

Re: [sqlite] Bugreport - slowdown in sqlite after the ANALYZE statement

2014-12-09 Thread James K. Lowden
On Tue, 09 Dec 2014 12:06:20 +0100 Jan Stan?k wrote: > INSERT INTO CoreCache (ModelID, ItemID) > SELECT ... > ORDER BY Year Why ORDER BY on INSERT? Does it work better? I would expect the unnecessary sort to be pure overhead. --jkl

Re: [sqlite] Bugreport - slowdown in sqlite after the ANALYZE statement

2014-12-11 Thread James K. Lowden
On Wed, 10 Dec 2014 08:49:21 +0100 Eduardo Morras wrote: > > Why ORDER BY on INSERT? Does it work better? I would expect the > > unnecessary sort to be pure overhead. > > If you insert in correct index order, the index update phase is > faster because it don't need

Re: [sqlite] How do I update multiple rows in a single sql statement

2014-12-11 Thread James K. Lowden
On Tue, 09 Dec 2014 10:46:23 -0500 Igor Tandetnik <i...@tandetnik.org> wrote: > On 12/9/2014 10:38 AM, James K. Lowden wrote: > > If the subquery to the right of the SET clause produces > > more than one row, the statement fails. > > Are you sure? Normally, a scalar

Re: [sqlite] Feature Request - RowCount

2014-12-13 Thread James K. Lowden
On Sat, 13 Dec 2014 14:15:15 +0200 RSmith wrote: > Most DB Admin tools out there displays the number of rows in a table > when you select it or open it, so too the one I am working on and > after testing stuff on Simon's question about the row counting, I > realised that

Re: [sqlite] Client/Server Best Practices

2015-01-02 Thread James K. Lowden
On Thu, 25 Dec 2014 05:32:45 -0700 (MST) Rick Kelly wrote: > All SELECT type requests are wrapped with BEGIN TRANSACTION/COMMIT That shouldn't be necessary and afaik isn't necessary. SELECT does not modify the database. To "commit a select" is to apply the nonchanges. A

Re: [sqlite] New column in select will not mask column of the same name in having clause and sqlite won't warn

2015-01-02 Thread James K. Lowden
On Sun, 28 Dec 2014 17:46:08 +0100 Tomas Telensky wrote: > select kvadrat, datum, count(distinct kontrola) as pocet > from b > group by kvadrat, datum > having pocet > 1 > > The problem was that pocet was actually a column in table b and I > didn't notice, and the

Re: [sqlite] Is this date supposed to be less than or more than the other?

2015-01-02 Thread James K. Lowden
On Fri, 2 Jan 2015 16:12:23 -0800 J Decker wrote: > I understand it's kept as a string... It might be more helpful to think of it not in terms of how it's "kept" but as what its type is. How it's kept is up to the DBMS to decide. But the column is of a type: one of text,

Re: [sqlite] New column in select will not mask column of the same name in having clause and sqlite won't warn

2015-01-07 Thread James K. Lowden
On Mon, 5 Jan 2015 06:39:42 + Hick Gunter wrote: > This is completely legal and well defined. > > HAVING is applied to the RESULT set of a SELECT. I beg to differ. It's both invalid SQL and (therefore) undefined. Furthermore, it's illogical. Consider: create

Re: [sqlite] Client/Server Best Practices

2015-01-07 Thread James K. Lowden
On Fri, 02 Jan 2015 21:41:02 -0700 "Keith Medcalf" <kmedc...@dessus.com> wrote: > On Friday, 2 January, 2015 16:26, James K. Lowden > <jklow...@schemamania.org> said: > > >On Thu, 25 Dec 2014 05:32:45 -0700 (MST) Rick Kelly > ><rpke...@gci.net> wr

Re: [sqlite] Client/Server Best Practices

2015-01-09 Thread James K. Lowden
On Wed, 07 Jan 2015 21:47:24 -0700 "Keith Medcalf" wrote: > >As I said, your description (which I trust is accurate) is very > >helpful to someone who wants to understand how SQLite will act on > >the SQL provided to it. But it also protrays problematic choices > >that

Re: [sqlite] New column in select will not mask column of the same name in having clause and sqlite won't warn

2015-01-09 Thread James K. Lowden
On Thu, 8 Jan 2015 08:42:25 + Hick Gunter wrote: > It is legal and well defined in SQLite. See the explain output below. > This is because of the well-documented feature of SQLite that columns > that are neither GROUPED BY nor aggregated will have a defined value. OK,

Re: [sqlite] Client/Server Best Practices

2015-01-16 Thread James K. Lowden
On Sat, 10 Jan 2015 00:58:25 -0700 "Keith Medcalf" wrote: > > there's no way to hook two SELECTs together to make them see one > >database state. That's what JOIN is for. :-) > > Yes, it is a part of the SQL Standard isolation levels in excess of > the default default of

[sqlite] sqlite3 shell in windows

2015-01-16 Thread James K. Lowden
Hello all, I had the bright idea yesterday of trying to use an extension module in Windows. I found myself a bit confused, and the messages and documentation were not as helpful as they might have been. I suspect I had a 32/64 bit mismatch in one case, and that sqlite3 wasn't compiled with

Re: [sqlite] sqlite3 tool bug

2015-01-16 Thread James K. Lowden
On Fri, 16 Jan 2015 10:38:54 -0800 Dave Dyer wrote: > [$] sqlite3 po.sqlite .dump | sqlite3 po2.sqlite > Error: incomplete SQL: INSERT INTO "imageblob" VALUES(1,'G:\share Perhaps try -echo, to display the incomplete SQL? I'm skeptical of the notion that cmd.exe is

Re: [sqlite] sqlite3 shell in windows

2015-01-17 Thread James K. Lowden
On Fri, 16 Jan 2015 14:31:40 -0800 Random Coder wrote: > If you're seeing the "Error: The specified procedure could not be > found." error, and you're not specifying an entry point in the .load > command, then no doubt the sqlite3_load_extension symbol isn't > properly

Re: [sqlite] sqlite3 shell in windows

2015-01-17 Thread James K. Lowden
On Fri, 16 Jan 2015 16:24:21 -0700 "Keith Medcalf" wrote: > >1. The architecture of an executable file, x86 or x64. > > dumpbin -- comes with the dev kit I would have thought so, but I didn't find an option that reports it. > Importantly make sure you are exporting "C"

[sqlite] OT: cmd.exe (was: sqlite3 tool bug)

2015-01-18 Thread James K. Lowden
On Sat, 17 Jan 2015 20:20:06 + Graham Holden wrote: > > I'm skeptical of the notion that cmd.exe is diddling with your data > > I would echo this: it's good at mangling the command-line, but I've > not been aware of it ever mangling data sent to a file/stream (other >

Re: [sqlite] Invalid column prefix returned in SELECT with joined subquery

2015-01-25 Thread James K. Lowden
On Sun, 25 Jan 2015 23:18:05 +0200 RSmith wrote: > There is no documentation in either SQLite or the SQL standard > that would lead anyone to believe that behavior is expected - in fact > it is very clear about the returned column names being > non-deterministic if not

Re: [sqlite] Invalid column prefix returned in SELECT with joined subquery

2015-01-25 Thread James K. Lowden
On Mon, 26 Jan 2015 02:28:33 + Simon Slavin wrote: > > each name in should be the shortest possible syntactically > > correct column reference. > > While you're discussing possibilties and alternatives, what should be > returned as the name for the following column >

Re: [sqlite] Invalid column prefix returned in SELECT with joined subquery

2015-01-26 Thread James K. Lowden
On Mon, 26 Jan 2015 09:05:32 +0200 RSmith wrote: > Understand, I do not think these are insurmountable problems, but two > questions arise: > - Who decides the rules for handling it so that it may become > "trusted" by DB users/admins/programmers, if not the SQL standard?

Re: [sqlite] Converting *.sqlite3 files

2015-01-27 Thread James K. Lowden
On Mon, 26 Jan 2015 19:26:49 + Luke Niewiadomski wrote: > I am looking to translate *.sqlite3 files into *.csv, or similar > format. Would you be willing to point me in the right direction? I > appreciate any help on this. for T in $(sqlite3

Re: [sqlite] Truncation of floating point numbers in SQLite?

2015-01-28 Thread James K. Lowden
On Wed, 28 Jan 2015 23:09:21 + Simon Slavin wrote: > > This is a bit of a speculative question related to a problem I'm > > having - are there legal values of a C++ double that would get > > truncated when written into and read from an SQLite database? > > In theory

Re: [sqlite] "database disk image is malformed" error occurs more

2015-01-31 Thread James K. Lowden
On Fri, 30 Jan 2015 13:17:26 -0500 Stephen Chrzanowski wrote: > 2.1 Filesystems with broken or missing lock implementations > > SQLite depends on the underlying filesystem to do locking as the > documentation says it will. But some filesystems contain bugs in their >

Re: [sqlite] Truncation of floating point numbers in SQLite?

2015-01-31 Thread James K. Lowden
On Fri, 30 Jan 2015 10:39:31 +0200 RSmith wrote: > At first I thought SQLite (or any RDBMS) should really strore > whatever you give and return it untouched, but that cannot be true > for an RDBMS because it has to interpret the data, it isn't just a > binary store. It has to

Re: [sqlite] sqlite3 fails due to too long path (MAX_PATHNAME)

2015-02-02 Thread James K. Lowden
On Mon, 02 Feb 2015 12:59:55 +0200 Török Edwin wrote: > Would it be possible to raise that limit, or output a better error > message that says why it failed to open the file? Maybe. open(2) should return ENAMETOOLONG. It is possible, though unlikely these days, that

Re: [sqlite] Truncation of floating point numbers in SQLite?

2015-02-02 Thread James K. Lowden
On Sun, 1 Feb 2015 02:13:15 +0100 Stephan Beal wrote: > On Sun, Feb 1, 2015 at 2:07 AM, Simon Slavin > wrote: > > > So, having established that NaN and -0 do not make the round trip > > from a C variable through a database and back into a C variable

Re: [sqlite] ordinary CTE containing sum()

2015-02-07 Thread James K. Lowden
On Sat, 7 Feb 2015 12:31:37 -0500 Doug Currie wrote: > In response to this SO question: > > http://stackoverflow.com/questions/28377210/how-to-retrieve-rank-based-on-total-mark-in-sqlite-table > > I tried to formulate a query without temp tables using an ordinary > CTE,

Re: [sqlite] ordinary CTE containing sum()

2015-02-08 Thread James K. Lowden
On Sun, 8 Feb 2015 09:57:54 -0500 Doug Currie wrote: > tonypdmtr on SO > posted a CTE solution; it is something like this, which works for me: > > with tt (S_id, total) as >(select S_id, sum(ca1) + sum(ca2) +

Re: [sqlite] equivalent for JOIN LATERAL

2015-02-08 Thread James K. Lowden
On Sun, 8 Feb 2015 23:52:43 +0100 Big Stone wrote: > I fall over this presentation of LATERAL, from postgresql guys. > > Does it exist in SQLITE ? Syntactically, no. Functionally, in part. > If not, would it be possible too much effort ? I'm guessing the answer is No

[sqlite] SQLite to SQL Server

2015-04-13 Thread James K. Lowden
On Mon, 13 Apr 2015 21:38:25 + "Drago, William @ CSG - NARDA-MITEQ" wrote: > Is there a convenient way to transfer data from SQLite to SQL Server? If I were doing it, I'd produce tab-delimited files with sqlite3 and use the SQL Server bcp utility to upload the output. The current trunk

[sqlite] JSON expressions for records and synchoronisation

2015-04-13 Thread James K. Lowden
On Fri, 10 Apr 2015 14:15:43 -0700 Roger Binns wrote: > On 04/10/2015 01:51 PM, Simon Slavin wrote: > > With a cursory glance I do see important incompatibilities with > > SQLite. > > I use JSON as the data format for $work stuff (startups) for years, > and these JSON schemas etc miss why some

[sqlite] Request: Metadata about C API constants and functions

2015-04-16 Thread James K. Lowden
On Thu, 16 Apr 2015 00:40:28 +0100 Simon Slavin wrote: > > It is a very productive time when you > > get to delete code :-) > > "[If] we wish to count lines of code, we should not regard them as "lines

[sqlite] How do non-SQLite DBMS communicate?

2015-04-23 Thread James K. Lowden
On Wed, 22 Apr 2015 22:28:57 + "Drago, William @ CSG - NARDA-MITEQ" wrote: > When using SQLite the application program accesses the SQLite DBMS > via its .dll file. The DLL is a function-call library. A function is a named bit of code. To "call a function" is to jump to that named bit of

[sqlite] Destroy all evidence of a database

2015-04-23 Thread James K. Lowden
On Wed, 22 Apr 2015 16:56:07 +0100 Simon Slavin wrote: > You have made me realise, however, that a nice attack against > encrypted SQLite databases might be to crash a SQLite application > while it's processing and examine any journal files, shared memory > file and temporary index files. It

[sqlite] json_* functions in sqlite

2015-04-23 Thread James K. Lowden
On Tue, 21 Apr 2015 18:09:33 -0700 Ashish Sharma wrote: > Many times I store JSON data in sqlite. It will be useful if sqlite > came with functions which understand JSON. Presto has a nice set > https://prestodb.io/docs/current/functions/json.html In case you don't know, you could implement

[sqlite] Thoughts on storing arrays of complex numbers

2015-04-24 Thread James K. Lowden
On Fri, 24 Apr 2015 13:37:40 + "Drago, William @ CSG - NARDA-MITEQ" wrote: > I'm trying to avoid re-inventing the wheel. Is there a best or > generally accept way to store arrays of complex numbers? A table in First Normal Form has no repeating groups. That means no row has an array of

[sqlite] SQLite and Scientific Computing: Arrays and Complex Numbers

2015-04-27 Thread James K. Lowden
On Mon, 27 Apr 2015 16:35:11 -0400 Jim Callahan wrote: > So, the application of arrays and complex numbers go far beyond the > one question posed to this list with arrays of integers and reals > being far more common than arrays of complex numbers. > > Complex numbers are included as types in

[sqlite] SQLite and Scientific Computing: Arrays and Complex Numbers

2015-04-29 Thread James K. Lowden
On Tue, 28 Apr 2015 09:24:56 +0200 Dominique Devienne wrote: > On Tue, Apr 28, 2015 at 4:16 AM, James K. Lowden > wrote: > > > A major hurdle is the memory model: because array-programming > > libraries normally mandate the data be in contiguous memory, > > there's a

[sqlite] Segfault during FTS index creation from huge data

2015-04-29 Thread James K. Lowden
On Wed, 29 Apr 2015 02:39:50 -0600 Scott Robison wrote: > On linux, malloc may return a non null yet invalid pointer and only > fail when the memory is accessed because it wasn't really available. Citation needed. I believe SIGSEGV is possible with anonymous mmap and overcommitted memory.

[sqlite] Segfault during FTS index creation from huge data

2015-04-29 Thread James K. Lowden
On Wed, 29 Apr 2015 01:27:03 +0300 Artem wrote: > >> Error: near line 1: out of memory > > > That's not a segfault, though, is it. > > When I did the same in linux version of SQLite - I saw > the "Segmentation Fault" error. The above message indicates that SQLite trapped an errno of ENOMEM

[sqlite] Segfault during FTS index creation from huge data

2015-04-30 Thread James K. Lowden
On Wed, 29 Apr 2015 20:29:07 -0600 Scott Robison wrote: > > That code can fail on a system configured to overcommit memory. By > > that standard, the pointer is invalid. > > > > Accidentally sent before I was finished. In any case, by "invalid > pointer" I did not mean to imply "it returns a

[sqlite] Does column order matter for performance?

2015-04-30 Thread James K. Lowden
On Thu, 30 Apr 2015 09:45:14 -0700 Pol-Online wrote: > I wasn?t able to find the answer to this question online: does the > column order matter for SQLite performance? E.g. should you put fixed > width columns like INTEGER before TEXT or BLOB? I'm going to check that box as No. SQLite

[sqlite] pragma temp_store_directory is deprecated, what is the alternative?

2015-08-14 Thread James K. Lowden
On Mon, 27 Jul 2015 20:35:30 +0100 Simon Slavin wrote: > On 27 Jul 2015, at 8:03pm, Zsb?n Ambrus wrote: > > > Does this work with the same environment variable name on both unix > > and windows? I'm asking because unix and windows programs each use > > different conventions for what

[sqlite] pragma temp_store_directory is deprecated, what is the alternative?

2015-08-18 Thread James K. Lowden
On Sat, 15 Aug 2015 01:17:28 +0100 Simon Slavin wrote: > > BTW, Posix is almost silent on the question. It says TMPDIR will > > define the location of a temporary store, but not how. > > I'm okay if the documentation simply says something like ... > > For Darwin (Mac), it's always /tmp/ >

[sqlite] Boolean constraint regression between 3.7.7.1 and 3.8.6?

2015-08-25 Thread James K. Lowden
On Mon, 17 Aug 2015 17:19:49 +0200 Olivier Barthelemy wrote: > CREATE TABLE VariableDetails (dtl_id INTEGER PRIMARY KEY ASC > AUTOINCREMENT, storage_implicit BOOLEANCHECK (storage_implicit = > 'true' OR storage_implicit = 'false'), storage_type TEXT NOT NULL); > > Insert statement > INSERT INTO

[sqlite] order by not working in combination with random()

2015-08-25 Thread James K. Lowden
On Mon, 17 Aug 2015 12:01:58 +0200 Clemens Ladisch wrote: > Just because the ORDER BY clause refers to a column of the > SELECT clause does not mean that the value is not computed > a second time. Let's at least recognize that as a bug. ORDER BY shouldn't interpret SQL or invoke functions.

[sqlite] order by not working in combination with random()

2015-08-26 Thread James K. Lowden
On Wed, 26 Aug 2015 13:39:09 +0100 Simon Slavin wrote: > > On 26 Aug 2015, at 11:27am, tonyp at acm.org wrote: > > > Plus, it apparently recognizes if the random() expression in the > > ORDER BY is the same as the SELECT one and again sort correctly > > (without re-evaluating) and without

[sqlite] ABOUT ROWID

2015-12-11 Thread James K. Lowden
On Fri, 11 Dec 2015 05:14:24 -0700 "Keith Medcalf" wrote: > Far better is to run the queries multiple times in succession (say, > 1000) and then average the result. Good advice. Sometimes it seems like caching is "cheating": we don't know the performance of something if we're using the cache.

[sqlite] Bug with DATETIME('localtime')

2015-12-13 Thread James K. Lowden
On Thu, 10 Dec 2015 06:34:44 -0700 "Keith Medcalf" wrote: > The only way to convert datetime data on windows is to use a > third-party package that does it properly, or write it yourself. > Using the WinAPI functions is equivalent to "writing it yourself" > because they do not actually do

[sqlite] Problem with accumulating decimal values

2015-12-15 Thread James K. Lowden
On Fri, 11 Dec 2015 16:21:30 +0200 "Frank Millman" wrote: > sqlite> UPDATE fmtemp SET balance = balance + 123.45; > sqlite> SELECT bal FROM fmtemp; > 5925.599 To a question like that you'll receive a lot of answers about numerical accuracy. And it's true that there are ways to "do the

[sqlite] Bug with DATETIME('localtime')

2015-12-16 Thread James K. Lowden
On Sun, 13 Dec 2015 20:11:32 -0700 Scott Robison wrote: > > It's not fixed, although gacial progress is being made. Even though > > we've had the TZ database & Posix datetime functions since 1986, 30 > > years later we're still struggling with it, and not only on Windows. > > The problem would

[sqlite] Problem with accumulating decimal values

2015-12-16 Thread James K. Lowden
On Wed, 16 Dec 2015 20:33:40 +0200 R Smith wrote: > > Ok this does not work of any scale of numbers. But a solution with > > integers neither does > > I think the bit that Keith tried to highlight is that we should > always refrain from storing errors. Keith recommended against storing

[sqlite] Problem with accumulating decimal values

2015-12-16 Thread James K. Lowden
On Wed, 16 Dec 2015 15:05:34 +0100 "E.Pasma" wrote: > 16 dec 2015, Keith Medcalf: > >> BEGIN; > >> UPDATE fmtemp SET bal = ROUND(bal,2) + 123.45; > >> (repeat a 1.000.001 times > >> END; > >> SELECT bal FROM fmtemp; > >> 123450123.45 > > > > You should NEVER round as you have done above. You

[sqlite] Behaviour when subquery behind comparison operator in where-clause returns empty result

2015-02-24 Thread James K. Lowden
On Wed, 18 Feb 2015 08:55:37 +0100 gunnar wrote: instead of > SELECT * > FROM ordercallback > WHERE account=@ACCOUNT >AND cb_seq_num>( > SELECT cb_seq_num > FROM ordercallback > WHERE cb_uuid=@CBUUID); SELECT * FROM ordercallback ocb WHERE account=@ACCOUNT AND exists (

[sqlite] Complex insert query to normalised database

2015-02-24 Thread James K. Lowden
On Wed, 18 Feb 2015 14:16:32 +0100 Staffan Tylen wrote: > I suspect that this is wrong as nobody has suggested it but isn't > this what triggers are meant to solve? Triggers were invented before SQL defined what we now call Declarative Referential Integrity (DRI). It is (I'm going to say)

[sqlite] Appropriate Uses For SQLite

2015-02-24 Thread James K. Lowden
On Thu, 19 Feb 2015 07:21:17 -0800 Roger Binns wrote: > There is a lot that would have to be done with it: > > - - make the IR stable across releases > - - add more general instructions beyond only what is needed for SQL > - - expose an API that takes the IR > - - possibly redesign it to make

[sqlite] recurrent failure mode

2015-02-25 Thread James K. Lowden
On Wed, 25 Feb 2015 16:26:45 -0800 Dave Dyer wrote: > >Do you have any multi-access things going on ? Two or more > >computers, applications, processes or threads trying to access the > >database at the same time ? > > No, but it would be normal for the database to be on a different > computer

[sqlite] Could frequent 'database is locked' errors mean SQLite is not a good fit for my application?

2015-07-02 Thread James K. Lowden
On Thu, 2 Jul 2015 10:09:12 -0400 Kathleen Alexander wrote: > Essentially, I have written an application in C++ that interfaces > (reads and writes) with a SQLite database, and I am getting lots of > 'database is locked' errors. [...] > > My application runs on Linux (ubuntu 13.10), and is

[sqlite] Slow real world performance - Any suggestions please (warning long)

2015-07-05 Thread James K. Lowden
On Fri, 3 Jul 2015 11:35:21 +0100 Rob Willett wrote: > It basically has taken no time to run 10,551 selects. This implies > that we had issues on the database before with either fragmentation > or indexes being poorly setup. Perhaps you said so and I missed it, but to me it's clear that

[sqlite] Suggestions for Fast Set Logic?

2015-07-10 Thread James K. Lowden
On Thu, 9 Jul 2015 22:28:04 +0100 Simon Slavin wrote: > If you're going to do it properly you have a keywords column which > contains strings like > > , > ,animal, > ,animal,predator, > ,animal,predator,bird, Why do it that way? I would recommend a schema like Keith's, with one keyword per

[sqlite] Suggestions for Fast Set Logic?

2015-07-11 Thread James K. Lowden
On Fri, 10 Jul 2015 09:54:27 -0600 Scott Robison wrote: > As described, the user will be able to create arbitrarily > complex queries. Since it is impossible to know in advance what > indexes might be required, breaking it down to individual sub queries > with simple where clauses that can be

[sqlite] Suggestions for Fast Set Logic?

2015-07-12 Thread James K. Lowden
On Sat, 11 Jul 2015 19:02:59 -0600 Scott Robison wrote: > > I don't follow you. A complex query is an assemblage of clauses. > > Whether or not broken down "to individual sub queries", the search > > arguments are the same. They are few in kind, even though they may > > be large in number.

[sqlite] User-defined types

2015-06-05 Thread James K. Lowden
On Fri, 5 Jun 2015 13:07:59 -0400 Stephen Chrzanowski wrote: > If N-Tier software development is 'annoying' and you are not happy, > either get help by other members of your team, or, find a different > hobby, because anything less than 3-tier programming dealing with > multiple languages,

  1   2   3   4   5   6   7   >