Re: [sqlite] Can sqlite3_blob_write be done through SQL?

2017-03-06 Thread James K. Lowden
On Sun, 5 Mar 2017 08:28:44 -0800 Yuri wrote: > > I think you?re better off reading the existing BLOB value into > > memory using SELECT, editing it using standard memory-manipulation > > routines, then writing it back with an UPDATE when you?re ready. > > This is very slow. Can you quantify th

Re: [sqlite] sqlite3 feature or regression

2017-03-07 Thread James K. Lowden
On Tue, 7 Mar 2017 09:36:34 +0100 Clemens Ladisch wrote: > I do not know what you expect to happen, or what actually happens, but > changing a table and reading it through a query at the same time has > an unspecified result. It is also unnecessarily complex and slow. To the OP, Vermes: if

Re: [sqlite] SQLite Recursive Common Table Expression suggestion

2017-03-07 Thread James K. Lowden
On Tue, 7 Mar 2017 13:30:00 +0100 Clemens Ladisch wrote: > Recursive CTEs make SQL Turing complete. > > But they cannot do everything. Isn't that a contradiction? --jkl ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://maili

Re: [sqlite] SQLite Recursive Common Table Expression suggestion

2017-03-07 Thread James K. Lowden
On Tue, 7 Mar 2017 20:26:41 +0100 Clemens Ladisch wrote: > James K. Lowden wrote: > > Clemens Ladisch wrote: > >> Recursive CTEs make SQL Turing complete. > >> > >> But they cannot do everything. > > > > Isn't that a contradiction? >

Re: [sqlite] More built-in functions for basic math

2017-03-09 Thread James K. Lowden
On Thu, 9 Mar 2017 10:45:36 +0100 Dominique Devienne wrote: > I find that I'm often missing basic mathematical functions in the > default shell. $ sqlite3 -header <<< 'select typeof(1/0) as "how many";' how many null Until SQLite deals with math as math, what is the point of adding mathematical

Re: [sqlite] sqlite3 feature or regression

2017-03-09 Thread James K. Lowden
On Tue, 7 Mar 2017 19:04:47 +0100 Vermes Mátyás wrote: > > It is also unnecessarily complex and slow. > > The script demonstrates a regression (a bug). It is written in Ruby > so that everybody can run it, and see its _results_. It is absolutely > not interesting that it is slow or complex.

Re: [sqlite] Drop view ?automatically? when its associated table is dropped?

2017-03-23 Thread James K. Lowden
On Wed, 22 Mar 2017 15:07:41 + Simon Slavin wrote: > On 22 Mar 2017, at 11:52am, R Smith wrote: > > > > May I add further that views are tricky things. They can refer to > > multiple tables, or other views which in turn refer to multiple > > tables or yet other views (and have obscured the

Re: [sqlite] RIGHT JOIN! still not supported?

2017-03-23 Thread James K. Lowden
On Wed, 22 Mar 2017 10:53:09 -0500 Jeffrey Mattox wrote: > Isn't it possible to get the same results of a RIGHT JOIN by using > two selects with a UNION or UNION ALL between them. Yes. By definition, an outer join is the union of the rows that meet the matching criteria and the

Re: [sqlite] Drop view ?automatically? when its associated table is dropped?

2017-03-23 Thread James K. Lowden
On Thu, 23 Mar 2017 11:56:00 + Simon Slavin wrote: > > This problem and other related with the lack of a "data dictionary" > > in sqlite, > > Not sure what you expect here. Can you point me at a "data > dictionary" for some other implementation of SQL ? https://www.postgresql.org/docs/9.1

Re: [sqlite] Drop view ?automatically? when its associated table is dropped?

2017-03-24 Thread James K. Lowden
On Fri, 24 Mar 2017 01:15:50 + Simon Slavin wrote: > SQLite does not seem to parse views or triggers for dependencies. If > it did it wouldn?t allow this view or these triggers. I guess you mean SQLite doesn't parse a view when it processes CREATE VIEW or, if it does, doesn't retain depende

Re: [sqlite] Drop view ?automatically? when its associated table is dropped?

2017-03-24 Thread James K. Lowden
On Fri, 24 Mar 2017 11:03:10 -0400 Richard Hipp wrote: > On 3/24/17, James K. Lowden wrote: > > > > We know SQLite parses SQL to produce byte-code for its virtual > > machine. And we know that's an abstract syntax tree. And we know > > trees can be represent

Re: [sqlite] Reporting Solutions that work with SQLite / VB 2015?

2017-03-24 Thread James K. Lowden
On Fri, 24 Mar 2017 19:29:07 + (UTC) Craig Bisgeier wrote: > I am wondering if anyone can recommend a free or low-cost reporting > solution that will work with SQLite and be compatible with Visual > Basic 2015 as an embedded or callable application?  This is a project > that will never make a

Re: [sqlite] Reporting Solutions that work with SQLite / VB 2015?

2017-04-01 Thread James K. Lowden
On Sat, 25 Mar 2017 22:32:49 -0700 Cousin Stanley wrote: > James K. Lowden wrote: > > https://github.com/jklowden/sqlrpt > > I installed your sqlrpt program under debian linux > and managed to successfully run it with an sql query > from a file >

Re: [sqlite] BUG: CLI generates invalid SQL for strings with many newlines

2017-04-01 Thread James K. Lowden
On Fri, 31 Mar 2017 21:59:05 +0200 Clemens Ladisch wrote: > since commit 68f6dc7af1013f29, newlines in the .dump output are > escaped with char(). Why not use vis(3) instead? No one seemed to notice when I offered the suggestion. Newline encoding is a solved problem. There's no need to to

Re: [sqlite] Reporting Solutions that work with SQLite / VB 2015?

2017-04-03 Thread James K. Lowden
On Mon, 03 Apr 2017 06:26:35 -0700 Cousin Stanley wrote: > e.g. lines with . == My mistake, sorry. A little git hiccup. You found the correct fix. And the repository now holds a correct version. --jkl ___ sqlite-us

Re: [sqlite] 3.18 Problem

2017-04-03 Thread James K. Lowden
On Sun, 2 Apr 2017 23:50:01 +1000 David Burgess wrote: > The rules for the format of these numbers has changed over time and > the schema has changed with the rules of the time. PRAGMA > integrity_check now complains about some rows not passing the > constraint. No one suggested the obvious solu

Re: [sqlite] BUG: CLI generates invalid SQL for strings with many newlines

2017-04-03 Thread James K. Lowden
On Sun, 2 Apr 2017 09:40:36 +0200 Clemens Ladisch wrote: > > Why not use vis(3) instead? > > Because vis() is a nonstandard function that is not available > everywhere, "everywhere" is a high standard, but vis is freely available and included or packaged with almost anything not Windows. By u

Re: [sqlite] Testing sqlite db to see if exists & ready

2017-04-06 Thread James K. Lowden
On Thu, 6 Apr 2017 13:19:38 +0100 Simon Slavin wrote: > Instead use PHP functions to check that the file exists using PHP > function "file_exists()" and then using fread() to read the first 16 > bytes from it. Those 16 bytes should be "SQLite format 3" followed > by a 0x00 byte for a string term

Re: [sqlite] Is it possible to create the Stored Procedure (SP) in Sqlite?

2017-04-19 Thread James K. Lowden
On Sun, 16 Apr 2017 12:01:01 +0200 Darko Volaric wrote: > There are good reasons to have stored procedures other than reducing > connection latency - developers like to encapsulate logic that is > associated entirely with the database in the database, use them to do > extended checking, to popula

Re: [sqlite] Security vulnerabilities prevalent in web tutorials for PHP, javascript, etc..

2017-04-24 Thread James K. Lowden
On Sun, 23 Apr 2017 21:31:42 +0100 Simon Slavin wrote: > If you don?t understand what you?re doing, hire an experienced > programmer. Ah, but you don't know what you don't know. After all, 90% of programmers rate themselves "above average". When I first heard of "SQL injection" years ago,

Re: [sqlite] auntondex with unique and integer primary key

2017-05-25 Thread James K. Lowden
On Fri, 19 May 2017 13:06:23 -0600 "Keith Medcalf" wrote: > You asked for the extra index to be created in the table > specification. It is not the job of the database engine to correct > your errors (it is not even possible to know if it is an error). He didn't ask. It's not an error. And

Re: [sqlite] NOT NULL integer primary key

2017-05-25 Thread James K. Lowden
On Fri, 19 May 2017 12:47:32 -0600 "Keith Medcalf" wrote: > > Create table test (id integer not null primary key, data text); > > insert into test values (null, 'row1'); > > select * from test; > > 1, row1 > Specifying NOT NULL on an INTEGER PRIMARY KEY (which is an alias for > the RowID) is a r

Re: [sqlite] NOT NULL integer primary key

2017-05-26 Thread James K. Lowden
On Fri, 26 May 2017 18:04:14 +0200 (CEST) Eric wrote: > Why should the INSERT return an error? It is quite OK to, when > inserting a row, not specify a value for a NOT NULL column - as long > as the DDL has specified some way of constructing a value. The SQL in question is >>> insert into test

Re: [sqlite] Does prepare do arithmetic?

2017-05-30 Thread James K. Lowden
On Mon, 29 May 2017 16:18:17 +0200 R Smith wrote: > Actually what Richard is saying is that you SHOULD do the arithmetic > yourself when you can, because you can boldly make assumptions about > the code that you write, but he, or the SQLite engine to be precise, > cannot be so bold, it may not b

Re: [sqlite] Please remove multiple warnings from compiler about optimisation, variable conversion, signed overflow and many more potential errors.

2017-10-05 Thread James K. Lowden
On Fri, 29 Sep 2017 16:55:05 -0400 Igor Korot wrote: > But then why not give it some default value ("0" maybe") and default > it to "1" only if needed during configure? Because complexity. It takes effort --- unnecessary effort -- to set up that default. That effort could introduce an error, w

[sqlite] using a custom memory allocator in TH3

2018-09-29 Thread James K. Lowden
After stumbling on SQLite's description of its memory allocators, I decided to write a one for testing that might be slow but is certainly robust.[1] I thought it might be interesting to hook it up to TH3, but I don't understand how to do that. The instructions say: 1. Generate the code 2.

Re: [sqlite] Persistent snapshots and rollbacks

2018-10-05 Thread James K. Lowden
On Fri, 5 Oct 2018 17:39:57 +0200 Daniel Kraft wrote: > I need the ability to make multiple changes / commits to my SQLite > database but keep snapshots of previous states and potentially roll > back to those states later on. All of that needs to be persistent, > i.e. survive closing the databas

Re: [sqlite] SQLite Windows GUI alternative to Excel?

2018-10-09 Thread James K. Lowden
On Sat, 6 Oct 2018 21:21:38 +0100 Simon Slavin wrote: > There is never any point in this process when a manager looks at > what's being done with Excel and says "Okay we need to hire a > programmer to turn this into a proper App.". Hmm, there is such a point. I used to do work like that, and t

Re: [sqlite] Question about a query

2018-10-09 Thread James K. Lowden
On Tue, 9 Oct 2018 10:22:12 -0700 Jens Alfke wrote: > You could implement a custom query function to do this (custom > functions are quite simple, and there are examples online). http://www.schemamania.org/sql/sqlite/udf/ Been there, done that. :-) --jkl

Re: [sqlite] Bug: float granularity breaking unique contraint?

2018-11-01 Thread James K. Lowden
On Thu, 1 Nov 2018 01:18:26 +0100 szmate1618 wrote: > But there seems to be an unintended > workaround > > DROP TABLE IF EXISTS TestReal;CREATE TABLE TestReal(A REAL > UNIQUE);INSERT INTO TestReal values (9223372036854775807);INSERT INTO > TestReal values (9223372036854775807 - 1);INSERT INTO Te

Re: [sqlite] forming sqlite3_statements using stored sql

2018-11-01 Thread James K. Lowden
On Thu, 1 Nov 2018 08:41:51 +0100 Clemens Ladisch wrote: > > It strikes me that this would be nicer if sqlite offered this as > > an intrinsic capability. > > How would SQLite know what the table and column names are? When the SQL is loaded, it can be parsed and analyzed. SQLite could, if i

Re: [sqlite] forming sqlite3_statements using stored sql

2018-11-03 Thread James K. Lowden
On Fri, 2 Nov 2018 15:24:51 -0700 Jens Alfke wrote: > > On Nov 2, 2018, at 12:50 AM, Thomas Kurz > > wrote: > > > > My opinion is that the logic for database queries should be held > > together with the data. > > Why? The logic has to be in the application itself (where else would > it come fr

Re: [sqlite] Suitability for Macintosh OS 9.2?

2018-11-19 Thread James K. Lowden
On Mon, 19 Nov 2018 17:16:37 +0100 Dominique Devienne wrote: > Most of the SQLite code is platform agnostic, but at some point, it > must interface with the local filesystem on the local platform. While your first challenge will probably be to get a sufficiently modern C compiler for OS 9, Domin

Re: [sqlite] sqlite3_bind_text() and WHERE x IN (?)

2018-12-05 Thread James K. Lowden
On Fri, 30 Nov 2018 23:25:48 +0900 Simon Walter wrote: > > SELECT id, data FROM val WHERE id IN ("1, 893, 121212"); ... > I have no idea yet if MySQL and/or PostgreSQL can handle this > scenario and how they do it. The important thing to understand about parameterized queries is that they are n

Re: [sqlite] Corrupted database: On tree page 76852 cell 303: Rowid 18741471 out of order

2018-12-05 Thread James K. Lowden
On Wed, 5 Dec 2018 05:21:30 + Simon Slavin wrote: > On 5 Dec 2018, at 5:16am, Ryan Schmidt wrote: > > > https://kb.vmware.com/s/article/1008542 > > > > "VMware ESX acknowledges a write or read to a guest operating > > system only after that write or read is acknowledged by the > > hardware

Re: [sqlite] Window functions?

2014-09-11 Thread James K. Lowden
On Wed, 27 Aug 2014 18:25:28 -0600 "Keith Medcalf" wrote: > >> select id, category_id, name, min(price) as minprice > >>from cat_pictures > >> group by category_id; > > >This peculiar behavior is very unique to SQLite. > > Not really. Sybase, SQL Server and DB2 do (or did do) the same thi

Re: [sqlite] presentation about ordering and atomicity of filesystems

2014-09-12 Thread James K. Lowden
On Fri, 12 Sep 2014 19:38:53 +0100 Simon Slavin wrote: > I don't think it can be done by trying to build it on top of an > existing file system. I think we need a file system (volume format, > drivers, etc.) built from the ground up with > atomicity/ACID/transactions in mind. Since the greatest

Re: [sqlite] presentation about ordering and atomicity of filesystems

2014-09-13 Thread James K. Lowden
On Sat, 13 Sep 2014 01:07:59 +0100 Simon Slavin wrote: > > Implement a block-transaction store on the device > > itself: no inodes, no directories, just writeable blocks managed in > > transactions. Build your DBMS on that. > > That would be ... erm ... perhaps a new disk volume format. Wher

Re: [sqlite] presentation about ordering and atomicity of filesystems

2014-09-14 Thread James K. Lowden
On Sat, 13 Sep 2014 15:43:00 -0400 Richard Hipp wrote: > There were often restrictions on the permitted values for block > sizes. And you couldn't ask the operating system to tell you whether > a file was text or binary or sequential or random-access or what its > block-size was; you just had t

Re: [sqlite] Divide by 0 not giving error

2014-09-15 Thread James K. Lowden
On Mon, 15 Sep 2014 21:13:01 +0100 Simon Slavin wrote: > > I suppose we then get into a discussion of what is the 'correct > > result'. I completely understand that NULL is unknown, but I've > > always thought that there is a difference between unknown and > > 'error'. > > It is not an error to

Re: [sqlite] Divide by 0 not giving error

2014-09-16 Thread James K. Lowden
On Tue, 16 Sep 2014 01:42:11 +0100 Simon Slavin wrote: > > Whether or not something "is an error" is a matter of definition. > > SQLite defines division by zero to be NULL. It's very unusual in > > that regard. > MySQL does it too unless ERROR_FOR_DIVISION_BY_ZERO mode is enabled: ... > Postgre

Re: [sqlite] Divide by 0 not giving error

2014-09-16 Thread James K. Lowden
On Tue, 16 Sep 2014 08:59:31 +0200 Jean-Christophe Deschamps wrote: > This would means that if ever an SQL statement encounters divide by > zero, the application will crash with no way handle the situation > gracefully, nor to locate the source of the problem. Seriously, what are you talking a

Re: [sqlite] Create join and add unique column

2014-09-16 Thread James K. Lowden
On Tue, 16 Sep 2014 16:38:09 +0200 RSmith wrote: > On 2014/09/16 15:32, Paul Sanderson wrote: > > select _rowid_, * from tab3 does the trick - thanks all > > Indeed, and if you are pedantic or do not work in a table with > rowids, the solution is to explicitly give the table definition Or not u

Re: [sqlite] An order by problem, maybe a bug?

2014-09-19 Thread James K. Lowden
On Fri, 19 Sep 2014 02:02:30 +0100 Simon Slavin wrote: > By the way I wanted to warn you about starting any project with first > name, middle name and last name fields. This leads to problems, and > I would go to some lengths to avoid it if possible. It would be > better to provide two columns:

Re: [sqlite] An order by problem, maybe a bug?

2014-09-20 Thread James K. Lowden
On Fri, 19 Sep 2014 11:42:26 -0700 Roger Binns wrote: > You do realise there are more people in the US than just those born > in the country with good old fashioned roman alphabet 26 ascii > letters? Yes. Did I mention ASCII? --jkl ___ sqlite-use

Re: [sqlite] An order by problem, maybe a bug?

2014-09-20 Thread James K. Lowden
On Fri, 19 Sep 2014 17:40:52 +0100 Simon Slavin wrote: > > Problems arising from the schema you suggest: > > > > 1. select by last name > > 2. select by first name > > 3. duplicate detection[1] > > 4. "however they want" is unknown and idiosyncratic > > 5. "whatever order" may be more than

Re: [sqlite] An order by problem, maybe a bug?

2014-09-21 Thread James K. Lowden
On Sat, 20 Sep 2014 20:21:29 +0100 Simon Slavin wrote: > > Your suggestion essentially amounts to "names are not > > decomposable, so keep one version for the user and one for the > > system." > > Sorry, I don't think I got that across effectively. If I make up a > database that stores names, I

Re: [sqlite] Expose struct Mem and struct Vdbe to other application

2014-09-23 Thread James K. Lowden
On Tue, 23 Sep 2014 14:12:19 -0500 "dave" wrote: > sounds like you are trying to 'bind' your column buffers once for > the statement, sort of like we do with, say ODBC. (and sort of like > we do in sqlite for parameters). To wit there is not a means of > doing that, but are you sure these column

Re: [sqlite] Results of Joins in sqlite

2014-09-24 Thread James K. Lowden
On Wed, 24 Sep 2014 11:03:53 +0530 Prakash Premkumar wrote: > Let's say an output of the join is: > > r11,r21,r31 > r11,r21,r32 > r11,r21,r33 > > where r1i is the i th row in T1, r2i is the i th row in T2 and r3i is > the ith row in T3: > > sqlite produces 3 result rows , but I would like to p

Re: [sqlite] Crash when binding default column value

2014-09-24 Thread James K. Lowden
On Wed, 24 Sep 2014 09:49:36 -0400 Richard Hipp wrote: > > * SQL injection attacks; > > > > You are doing CREATE TABLE statements based on text from an untrusted > user? Really? My reaction exactly. > > * floating point value rounding in conversion to/from text; If the default cannot be

Re: [sqlite] Crash when binding default column value

2014-09-24 Thread James K. Lowden
On Wed, 24 Sep 2014 20:53:32 +0100 Nathaniel Trellice wrote: > > > You are doing CREATE TABLE statements based on text from an > > > untrusted user? Really? > > > My reaction exactly. > > > I'm writing a library so the safety of the input is out of my hands > and in that of the application

Re: [sqlite] Division accuracy

2014-09-24 Thread James K. Lowden
On Wed, 24 Sep 2014 20:51:38 +0200 RSmith wrote: > I was thinking in stead of maybe having a prev and next column, to > just have a next column which points to an ID. ... > ID | Next | Data > 1 | 4 | 'First Row' > 2 | 3 | 'Eventual Fourth Row' > 3 | 1 | 'Last Row' > 4 | 5 |

Re: [sqlite] Division accuracy

2014-09-25 Thread James K. Lowden
On Thu, 25 Sep 2014 10:36:31 +0200 Clemens Ladisch wrote: > > The first question I'd have is: Where are the ordering criteria, > > and why aren't they in the database? Someone is imposing an order, > > but the basis for it is not included in the database design. > [amusing list omitted

Re: [sqlite] Division accuracy

2014-09-25 Thread James K. Lowden
On Thu, 25 Sep 2014 18:40:23 +0200 RSmith wrote: > It's much harder to make a mathematical positioning result than > simply working out if the current is better or worse than any > existing position. So you say. But someone is doing *something* to determine who comes before whom. Even synchron

Re: [sqlite] GROUP BY: ambiguous column name?

2014-09-25 Thread James K. Lowden
On Thu, 25 Sep 2014 20:32:29 +0200 Mark Lawrence wrote: > I would have expected the group to work the same as the order, given > that I think of the group as happening on the result set before any > joins. ORDER BY is different. It's not even *related* to GROUP BY. To elaborate on Cory Nels

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 :) You can always

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 consistency. They prev

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 > its declaration, it'd

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 wrote: > On Wed, Oct 8, 2014 at 8:38 PM, James K. Lowden > wrote: > > > > > The problem I see with your suggestion is that I can't think of > > another situation, with or without NULL, wit

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 responsibly". The first r

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, because SQL is a specification, 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 single-byte encoding,

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 best/simplest way to find the sec

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 directory > (ext4)? See -o grpi

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 > Windows), The name is not

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 wrote: > "James K. Lowden" writes: > > > See -o grpid in mount(8). I think that's what you want. > > Thanks. It works! Hmm, I'm glad, but as David Woodhouse pointed out, it shouldn't have bee

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 number below 50? > > S

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 others besides: 1. re

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 inefficient table scans

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 index or ineffic

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 files. SQLITE_OMIT_* > compile-t

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 64-bit long integers. Flo

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 check if a record > exists

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 (outer join) then apply

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 > https://www.sqli

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 right way to do it is neithe

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 as > JOIN tableA, tableB WHE

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

2014-11-10 Thread James K. Lowden
ECT * 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 > Betreff: Re:

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) > INSERT INTO zWeeks (Week)

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 own mathematical libra

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, SELECT's

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. SQL has value semantic

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 > latency in the read is fine

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. [...] > Your thoughts on th

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 point number and an

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 respected. Hmm, I guess you mean

Re: [sqlite] Bug report: USBAN failure

2014-12-03 Thread James K. Lowden
On Wed, 03 Dec 2014 08:56:44 +0100 Clemens Ladisch 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) > > __THROW __nonnull

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 same way > as FKs. When ad

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 > (0,2) and there is o

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 UPDATE...FROM that I know is on S

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 ___ sqlite-

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 rebalance the b-tree so of

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 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 subquery doesn't

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 selecting a large table a

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 common misconceptio

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 having clause was using the tab

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, integer, and double.

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 table T (a int, b int

Re: [sqlite] Client/Server Best Practices

2015-01-07 Thread James K. Lowden
On Fri, 02 Jan 2015 21:41:02 -0700 "Keith Medcalf" wrote: > On Friday, 2 January, 2015 16:26, James K. Lowden > said: > > >On Thu, 25 Dec 2014 05:32:45 -0700 (MST) Rick Kelly > > wrote: > > >> All SELECT type requests are wrapped with BEGIN TRANSACTI

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 stray from SQL's defined b

<    1   2   3   4   5   6   7   8   9   10   >