[sqlite] Assertion `pC!=0' failed.

2019-12-31 Thread Yongheng Chen
Hi,

We found an assertion failed in sqlite. Here’s the POC:
—
CREATE TABLE v0 ( v1 INTEGER PRIMARY KEY ON CONFLICT ROLLBACK NOT NULL ON 
CONFLICT IGNORE , v2 FLOAT AS( 'BUILDING' ) CHECK( 10 ) CHECK( v2 NOT LIKE 'MED 
BAG' ) NOT NULL UNIQUE ) ;
INSERT INTO v0 VALUES ( 10 ) ;
SELECT * FROM v0 JOIN v0 USING ( v1 , v2 , v1 , v1 , v1 , v2 ) WHERE ( ( ( 1 = 
( SELECT v0 . v1 FROM v0 AS x GROUP BY v2 ) AND v2 = 0 ) OR v1 = 10 ) ) AND v2 
IN ( SELECT v2 FROM v0 ) ;
—-

This exists in the latest development code built with debug flag.

Yongheng & Rui
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Assertion `pWalker->eCode==0' failed.

2019-12-31 Thread Yongheng Chen
Hi,

We found an assertion failed in sqlite. Here’s the POC:
—
CREATE TABLE v0 ( v1 INT , v2 INT ) ;
CREATE TABLE v3 ( v4 DOUBLE PRIMARY KEY UNIQUE NOT NULL ) ;
SELECT * FROM v3 LEFT JOIN v0 ON v1 = 10 WHERE ( v2 < 10 AND v1 = 10 ) > ( v2 < 
0 AND v1 > 10 AND ( v1 = 10 AND 10 ) ) ORDER BY v1 DESC , v2 DESC ;
—-

This exists in the latest development code built with debug flag.

Yongheng & Rui
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Crash Bug In sqlite

2019-12-31 Thread Yongheng Chen
Hi, 

We found a crash bug in sqlite. Here’s the POC:
—
CREATE VIRTUAL TABLE v0 USING fts4 ( v1 , v2 , v3 , v4 ) ;
INSERT INTO v0 ( v1 ) VALUES ( 10 ) ,( 10 ) ; 
CREATE TABLE v5 ( v6 UNIQUE NOT NULL PRIMARY KEY UNIQUE ) ; 
INSERT INTO v5 ( v6 , v6 ) SELECT nullif ( DISTINCT zeroblob ( julianday () ) , 
v3 ) , v1 + 10 FROM v0 ;
—

Here’s the backtrace:
—
#0  __memcmp_sse4_1 () at ../sysdeps/x86_64/multiarch/memcmp-sse4.S:69
#1  0x00661302 in sqlite3BlobCompare (pB1=, 
pB2=) at sqlite3.c:81071
#2  0x0063d703 in sqlite3VdbeMemAboutToChange (pVdbe=, 
pMem=) at sqlite3.c:75954
#3  0x00626b49 in sqlite3VdbeExec (p=) at sqlite3.c:85159
#4  0x004b076b in sqlite3Step (p=) at sqlite3.c:82730
#5  sqlite3_step (pStmt=) at sqlite3.c:17259
#6  0x00484686 in exec_prepared_stmt (pArg=0x7fff5a635990, 
pStmt=0x1956950) at shell.c:11383
#7  0x00442eea in shell_exec (pArg=, zSql=, pzErrMsg=) at shell.c:11688
#8  0x00487ad8 in runOneSqlLine (p=0x7fff5a635990,
zSql=0x193b480 "CREATE VIRTUAL TABLE v0 USING fts4 ( v1 , v2 , v3 , v4 ) ; 
INSERT INTO v0 ( v1 ) VALUES ( 10 ) ,( 10 ) ; CREATE TABLE v5 ( v6 UNIQUE NOT 
NULL PRIMARY KEY UNIQUE ) ; INSERT INTO v5 ( v6 , v6 ) SELECT n"...,
in=0x7f6b75fe38e0 <_IO_2_1_stdin_>, startline=1) at shell.c:18269
#9  0x00449a9f in process_input (p=) at shell.c:18369
#10 0x00418fb2 in main (argc=, argv=) at 
shell.c:19135
—

The bug exists in the latest development code. 

Yongheng & Rui
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Causal profiling

2019-12-31 Thread Jens Alfke


> On Dec 31, 2019, at 7:03 AM, Richard Damon  wrote:
> 
> 1) The C API between separate compilations is very well established, and 
> fully documented in most environments.

Agreed. APIs between library boundaries generally need to be C. This is pretty 
easy to do though (I've done it multiple times in my current job.) You just 
write some C wrappers for the public methods.


> On Dec 31, 2019, at 7:19 AM, Simon Slavin  wrote:
> 
> 5) SQLite has to work on your set top box.  On your Wifi base station.  On 
> your Home hub.  On the machine that runs the car park.  All these things have 
> C compilers.  Not all these things have C++ compilers.


This may have been an issue ten years ago, but is it still? I did some R on 
embedded systems last year, and C++ support looked pretty ubiquitous. The 
heftier embedded boards run Linux, the middleweight ones have C++-friendly 
environments like mbedOS or ESP32-IDF, and even tiny 8-bit Arduino 
microcontrollers have an OO C++ API, even though they call it C to avoid 
scaring the newbies.

—Jens
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 18 minutes 41 seconds

2019-12-31 Thread Ned Fleming

On 2019-12-30 18:13, Richard Hipp wrote:

That's the total elapse time from me checking in a bug (check-in
https://www.sqlite.org/src/info/40d10e7aad5b8992) until Manuel
Rigger's fuzzer had located the bug and issued a ticket against it:
(ticket https://www.sqlite.org/src/info/892575cdba4e1e36).

Well, at least the bisect didn't take very long!


Just for the curious, the over/under in Las Vegas was 19 minutes flat. 
So, depending on how you wagered, you can pick up your winnings or tear 
up your betting slip.


--
Ned

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Sanitising user input for FTS5 MATCH parameter

2019-12-31 Thread test user
Thanks for the details Dan

On Sat, 21 Dec 2019 at 18:40, Dan Kennedy  wrote:

>
> On 20/12/62 22:03, test user wrote:
> > Hello,
> >
> > I have a search box on a website that uses FTS5/MATCH.
> >
> > MATCH seems to take its own custom language for matching.
> >
> > 1. Is it safe to just pass the users query to MATCH ? via the SQLite bind
> > FFI?
>
> Users could specify a query that uses excessive resources. In
> particular, prefix searches for very common prefixes on large databases
> can use a lot of memory. I think it's otherwise safe though.
>
> > - This would give them full access to the FTS5 matching language.
> >
> > 2. If not, how should I be sanitising user input?
> >
> > - E.g. How can I transform a string of words and text into a query? What
> > characters should I be removing or escaping? How can I prevent them using
> > the FTS5 keywords "AND" "OR" etc?
> It really depends on what you want to allow. And how you want the query
> interpreted. If you want all input to be treated as a single phrase,
> enclose it in double-quotes, doubling any embedded " characters SQL
> style. Or, if you wanted the input treated as a list of terms separated
> by implicit AND, split the input on whitespace and then enclose each
> term in double-quotes. Details here:
>
>https://www.sqlite.org/fts5.html#full_text_query_syntax
>
> Dan.
>
>
>
>
> >
> > Thanks
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Causal profiling

2019-12-31 Thread Simon Slavin
On 31 Dec 2019, at 3:03pm, Richard Damon  wrote:

> I will give a short answer, in my opinion, of a few reasons on why C is still 
> a viable language.

5) SQLite has to work on your set top box.  On your Wifi base station.  On your 
Home hub.  On the machine that runs the car park.  All these things have C 
compilers.  Not all these things have C++ compilers.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Causal profiling

2019-12-31 Thread Richard Damon

On 12/31/19 3:13 AM, Jens Alfke wrote:

On Dec 30, 2019, at 6:23 PM, Alexander Vega  wrote:

-fdevirtualize
-fdevirtualize-speculatively

I believe those are C++ optimizations, specific to C++ virtual methods. What 
SQLite is doing is similar to a class with virtual methods, but done “by hand” 
in plain C, so the optimizer doesn’t know how to apply that optimization.

(I’m fighting the urge to write an off-topic rant about why anyone still 
programs in C when they could write roughly the same code much more simply and 
cleanly in C++ using only the most basic features like classes and methods. 
I’ve spent too much time lately trying to figure out or debug hellacious C 
spaghetti code that’s awkwardly reinventing wheels like inheritance and 
constructors/destructors.)

And in any case, de-virtualization only works when a virtual method has only 
one implementation, I.e. is monomorphic, and that isn’t true here.

—Jens


I will give a short answer, in my opinion, of a few reasons on why C is 
still a viable language.


1) The C API between separate compilations is very well established, and 
fully documented in most environments. C++ is less so, where sometimes 
important details like how to mangle names and occasionally handle 
exceptions not fully standardized between compilers on a given platform.


2) The way language support packages work, it is fully defined to have a 
C library in a C++ program, but it might not work to have a C++ library 
in a C program, you need to have a C++ compatible startup package (to 
run the constructors etc.). Changing a library from C to C++ is thus a 
backwards breaking change unless EVERYONE has migrated to C++.


3) The C language is much more stable. While some new features have been 
added to C in the last decade, the language has been very stable (yes, 
some legacy features that were included in C90 were later removed but 
that was for things that weren't recommended anyway). It is quite 
possible to have a code base designed to build on a C99 implementation 
(or even C90, perhaps with a few replacement headers like stdint.h for 
some very useful additions from C99) and have it still work with a 
totally up to date system. The C++ language has been much more fluid in 
language definition.


4) There still exists some embedded system that don't have a free C++ 
compiler, so such a change restricts it from some environment 
(admittedly, many of those may not have the resources to use SQLite well).


As an aside for that, SQLites 'virtual' functions aren't implementing 
something easy to do in C++ (except by doing the same thing), as to do 
what is being done you would have to change the 'type' of the SQLite 
'object'.


--
Richard Damon

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3VdbeMemAboutToChange(Vdbe *, Mem *): Assertion `(mFlags_Str)==0 || (pMem->n==pX->n && pMem->z==pX->z)' failed.

2019-12-31 Thread Jose Isaias Cabrera

Richard Hipp, on Tuesday, December 31, 2019 08:33 AM, wrote...
>
> On 12/31/19, Jose Isaias Cabrera  wrote:
> >
> > I don't know what "This bug affects debug builds...",
>
> This is yet another fault not in SQLite itself, but in the auxiliary
> VM register tracking logic that we use during testing and debugging.
> Hence, it only comes up if you compile with -DSQLITE_DEBUG.  An
> ordinary build works find and gives a correct answer.
>
> The VM register tracking logic does for the VM (approximately) what
> ASAN does for machine code - it tries to identify cases where the byte
> code is violating assumptions about the operation of the VM.
>
> In this particular instance, the issue raised by the VM register
> tracking logic was a false-positive.  The VM register tracking logic
> has been enhanced on trunk to avoid this particular false-positive, so
> the problem should no longer occur.

Thank you, Dr. Hipp.

josé
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3VdbeMemAboutToChange(Vdbe *, Mem *): Assertion `(mFlags_Str)==0 || (pMem->n==pX->n && pMem->z==pX->z)' failed.

2019-12-31 Thread Richard Hipp
On 12/31/19, Jose Isaias Cabrera  wrote:
>
> I don't know what "This bug affects debug builds...",

This is yet another fault not in SQLite itself, but in the auxiliary
VM register tracking logic that we use during testing and debugging.
Hence, it only comes up if you compile with -DSQLITE_DEBUG.  An
ordinary build works find and gives a correct answer.

The VM register tracking logic does for the VM (approximately) what
ASAN does for machine code - it tries to identify cases where the byte
code is violating assumptions about the operation of the VM.

In this particular instance, the issue raised by the VM register
tracking logic was a false-positive.  The VM register tracking logic
has been enhanced on trunk to avoid this particular false-positive, so
the problem should no longer occur.
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 18 minutes 41 seconds

2019-12-31 Thread Jose Isaias Cabrera

Indeed!  Thanks Dr. Hipp and the rest of the team for such a wonderful, and 
easy, and light, and robust, and... product.

josé


From: sqlite-users  on behalf of 
Manuel Rigger 
Sent: Tuesday, December 31, 2019 05:15 AM
To: SQLite mailing list 
Subject: Re: [sqlite] 18 minutes 41 seconds

Thanks for all your great work, Richard and Dan! Among all DBMS that we
have been testing, we have put most of our effort and energy into testing
SQLite. The reason for that is that you were by far the most responsive to
our bug reports, and typically address bugs immediately after we find them!
It's great that you take all bug reports seriously. In other widely-used
DBMS that we have been testing, bugs take weeks, months, or longer until
getting fixed.

Looking forward to another fruitful year of cooperating in making SQLite
even more robust!

Best,
Manuel

On Tue, Dec 31, 2019 at 7:26 AM Michael Falconer <
michael.j.falco...@gmail.com> wrote:

> >
> > There is no "year 0" between 1 BC and 1 AD.  This is perhaps the most
> > common fencepost problem in existance.  The "great renaming" of AD to CE
> > and doing away with BC by replacing them with "off by one" numbers less
> > than 1 does not change the fact that there was, in fact, no year 0.
>
> Obviously the character(s) responsible  for dates etc were NOT C
> programmers!
>
> On Tue, 31 Dec 2019 at 14:45, Richard Damon 
> wrote:
>
> > On 12/30/19 10:10 PM, Pierpaolo Bernardi wrote:
> > > On Tue, Dec 31, 2019 at 4:07 AM Keith Medcalf 
> > wrote:
> > >>
> > >> On Monday, 30 December, 2019 19:29, Michael Falconer <
> > michael.j.falco...@gmail.com> wrote:
> > >>
> > >>> As we approach the end of yet another year ( and indeed decade ).
> > >> Technically, every year is the end of a decade, if one means the
> > immediately preceding ten years.
> > >>
> > >> However, if you mean the end of the second decade of the 21st century,
> > you will have to wait another year for that.  January 1st, 0001 AD was
> the
> > first day of the year 1.  The first decade ended at the end of December
> > 31st 0011 AD, not December 31st, 0010 AD. (if following the proleptic
> > Gregorian calendar).
> > > Languages don't work like this.
> > >
> > > https://www.collinsdictionary.com/dictionary/english/decade
> > >
> > > Cheers
> >
> > Its a difference between ordinals and numerals. The 20th century was
> > from the beginning of 1901 to the end of 2000. We also have the century
> > called the 1900's which went from 1900 to the end of 1999.
> >
> > Decade would work the same way, the 202st decade goes from 2011 to end
> > of 2020, but the 2010s go from 2010 to end of 2019.
> >
> > --
> > Richard Damon
> >
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
> --
> Regards,
>  Michael.j.Falconer.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3VdbeMemAboutToChange(Vdbe *, Mem *): Assertion `(mFlags_Str)==0 || (pMem->n==pX->n && pMem->z==pX->z)' failed.

2019-12-31 Thread Jose Isaias Cabrera

Yongheng Chen, on Tuesday, December 31, 2019 03:21 AM, wrote...
>
> Hi,
>
> We found a debug assertion bug in sqlite. Here’s the PoC:
> —
> CREATE TABLE v0 ( v1 , v2 FLOAT ) ;
> CREATE TRIGGER x AFTER INSERT ON v0
> BEGIN
> INSERT INTO v0 SELECT DISTINCT v2 / 10 , v2 / 1 FROM v0 ;
> END;
> INSERT INTO v0 ( v1 , v1 ) VALUES ( '' , 10 ) ,( '' , 0 ) ,( 'AIR' , 10
> );
> UPDATE v0 SET v2 = randomblob ( v2 ) ;
> SELECT coalesce ( max ( quote ( v1 ) ) , 10 ) FROM v0 GROUP BY v1 ;
> —
>
> This bug affects debug builds based on trunk and the latest release
> version.
>
> Special thanks to Manuel Rigger for all his help. And thanks every one in
> the sqlite team for your great work.

I don't know what "This bug affects debug builds...", this worked on 3.30.0 
released version.

 8:10:31.22>sqlite3
SQLite version 3.30.0 2019-10-04 15:03:17
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE v0 ( v1 , v2 FLOAT ) ;
sqlite> CREATE TRIGGER x AFTER INSERT ON v0
   ...> BEGIN
   ...> INSERT INTO v0 SELECT DISTINCT v2 / 10 , v2 / 1 FROM v0 ;
   ...> END;
sqlite> INSERT INTO v0 ( v1 , v1 ) VALUES ( '' , 10 ) ,( '' , 0 ) ,( 'AIR' , 10 
);
sqlite> UPDATE v0 SET v2 = randomblob ( v2 ) ;
sqlite> SELECT coalesce ( max ( quote ( v1 ) ) , 10 ) FROM v0 GROUP BY v1 ;
NULL
''
'AIR'
sqlite>

But, I am not running any debugger. ;-)

josé
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Sanitizing module arguments in virtual table create statement

2019-12-31 Thread Richard Hipp
On 12/31/19, David Jones  wrote:
> Even though my example used the zipfile module, I want to handle the general
> case.

The virtual table mechanism passes the xCreate method of the virtual
table whatever text you enter.  It is up to the virtual table itself
to interpret that text however it wants.  Different virtual tables can
(potentially) do it differently.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL help

2019-12-31 Thread Jose Isaias Cabrera

True that. ;-)


From: sqlite-users  on behalf of 
x 
Sent: Tuesday, December 31, 2019 03:15 AM
To: SQLite mailing list 
Subject: Re: [sqlite] SQL help

LOL. English isnae oor furst language either. Ye ken whit a mean. 




From: sqlite-users  on behalf of 
Jose Isaias Cabrera 
Sent: Monday, December 30, 2019 9:50:22 PM
To: sqlite-users@mailinglists.sqlite.org 
Subject: Re: [sqlite] SQL help



x, on Saturday, December 28, 2019 10:46 AM, wrote...

> Apologies if that’s not worded correctly. Scottish education could be
> done gooder 

Wrong English! You should have said, "Scottish education could have been done 
gooder."  Com'on! This is not even my first language! :-)

josé
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Sanitizing module arguments in virtual table create statement

2019-12-31 Thread David Jones
My application naively tried preparing the statement: “CREATE VIRTUAL TABLE xxx 
USING zipfile(?1);” and
binding the name of the zip file, supplied by user, to parameter 1 for 
execution. This doesn’t work, and the documention reveals that this is by 
design. I therefore have to expand the argument(s) myself to get the
statement to prepare. The page says there are no restrictions on the argument 
other than balanced parentheses, leaving me unclear how the parser deals with 
the statement following left parenthesis after the module name.
Do I make the argument a literal and double embedded occurrences of single 
quotes?

Even though my example used the zipfile module, I want to handle the general 
case.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] 18 minutes 41 seconds

2019-12-31 Thread Manuel Rigger
Thanks for all your great work, Richard and Dan! Among all DBMS that we
have been testing, we have put most of our effort and energy into testing
SQLite. The reason for that is that you were by far the most responsive to
our bug reports, and typically address bugs immediately after we find them!
It's great that you take all bug reports seriously. In other widely-used
DBMS that we have been testing, bugs take weeks, months, or longer until
getting fixed.

Looking forward to another fruitful year of cooperating in making SQLite
even more robust!

Best,
Manuel

On Tue, Dec 31, 2019 at 7:26 AM Michael Falconer <
michael.j.falco...@gmail.com> wrote:

> >
> > There is no "year 0" between 1 BC and 1 AD.  This is perhaps the most
> > common fencepost problem in existance.  The "great renaming" of AD to CE
> > and doing away with BC by replacing them with "off by one" numbers less
> > than 1 does not change the fact that there was, in fact, no year 0.
>
> Obviously the character(s) responsible  for dates etc were NOT C
> programmers!
>
> On Tue, 31 Dec 2019 at 14:45, Richard Damon 
> wrote:
>
> > On 12/30/19 10:10 PM, Pierpaolo Bernardi wrote:
> > > On Tue, Dec 31, 2019 at 4:07 AM Keith Medcalf 
> > wrote:
> > >>
> > >> On Monday, 30 December, 2019 19:29, Michael Falconer <
> > michael.j.falco...@gmail.com> wrote:
> > >>
> > >>> As we approach the end of yet another year ( and indeed decade ).
> > >> Technically, every year is the end of a decade, if one means the
> > immediately preceding ten years.
> > >>
> > >> However, if you mean the end of the second decade of the 21st century,
> > you will have to wait another year for that.  January 1st, 0001 AD was
> the
> > first day of the year 1.  The first decade ended at the end of December
> > 31st 0011 AD, not December 31st, 0010 AD. (if following the proleptic
> > Gregorian calendar).
> > > Languages don't work like this.
> > >
> > > https://www.collinsdictionary.com/dictionary/english/decade
> > >
> > > Cheers
> >
> > Its a difference between ordinals and numerals. The 20th century was
> > from the beginning of 1901 to the end of 2000. We also have the century
> > called the 1900's which went from 1900 to the end of 1999.
> >
> > Decade would work the same way, the 202st decade goes from 2011 to end
> > of 2020, but the 2010s go from 2010 to end of 2019.
> >
> > --
> > Richard Damon
> >
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
> --
> Regards,
>  Michael.j.Falconer.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite3VdbeMemAboutToChange(Vdbe *, Mem *): Assertion `(mFlags_Str)==0 || (pMem->n==pX->n && pMem->z==pX->z)' failed.

2019-12-31 Thread Yongheng Chen
Hi,

We found a debug assertion bug in sqlite. Here’s the PoC:
—
CREATE TABLE v0 ( v1 , v2 FLOAT ) ;
CREATE TRIGGER x AFTER INSERT ON v0
BEGIN
INSERT INTO v0 SELECT DISTINCT v2 / 10 , v2 / 1 FROM v0 ;
END;
INSERT INTO v0 ( v1 , v1 ) VALUES ( '' , 10 ) ,( '' , 0 ) ,( 'AIR' , 10 );
UPDATE v0 SET v2 = randomblob ( v2 ) ;
SELECT coalesce ( max ( quote ( v1 ) ) , 10 ) FROM v0 GROUP BY v1 ;
—

This bug affects debug builds based on trunk and the latest release version.

Special thanks to Manuel Rigger for all his help. And thanks every one in the 
sqlite team for your great work. 

Yongheng & Rui
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL help

2019-12-31 Thread x
LOL. English isnae oor furst language either. Ye ken whit a mean. 




From: sqlite-users  on behalf of 
Jose Isaias Cabrera 
Sent: Monday, December 30, 2019 9:50:22 PM
To: sqlite-users@mailinglists.sqlite.org 
Subject: Re: [sqlite] SQL help



x, on Saturday, December 28, 2019 10:46 AM, wrote...

> Apologies if that’s not worded correctly. Scottish education could be
> done gooder 

Wrong English! You should have said, "Scottish education could have been done 
gooder."  Com'on! This is not even my first language! :-)

josé
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Causal profiling

2019-12-31 Thread Jens Alfke

> On Dec 30, 2019, at 6:23 PM, Alexander Vega  wrote:
> 
> -fdevirtualize
> -fdevirtualize-speculatively

I believe those are C++ optimizations, specific to C++ virtual methods. What 
SQLite is doing is similar to a class with virtual methods, but done “by hand” 
in plain C, so the optimizer doesn’t know how to apply that optimization.

(I’m fighting the urge to write an off-topic rant about why anyone still 
programs in C when they could write roughly the same code much more simply and 
cleanly in C++ using only the most basic features like classes and methods. 
I’ve spent too much time lately trying to figure out or debug hellacious C 
spaghetti code that’s awkwardly reinventing wheels like inheritance and 
constructors/destructors.)

And in any case, de-virtualization only works when a virtual method has only 
one implementation, I.e. is monomorphic, and that isn’t true here.

—Jens
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users