[sqlite] Reporting documentation issues/unclarity?

2020-01-21 Thread Merijn Verstraaten
Should issues with the documentation (i.e., missing/unclear things) be reported to this mailing list too? Specifically, something that was unclear to me while implementing my own aggregate function is what happens if sqlite3_result_error() is called and another result functions gets called

Re: [sqlite] Optimising query with aggregate in subselect.

2019-11-20 Thread Merijn Verstraaten
> On 20 Nov 2019, at 20:37, Andy Bennett wrote: > > Hi, > >> Did you try retrieving the data "directly" or do you need the subselect in >> order to maintain compatibility with other SQL dialects that are no longer >> able to retrieve data from the row on which the max was found? > > Thanks

Re: [sqlite] Custom window functions vs builtin

2019-11-12 Thread Merijn Verstraaten
> On 12 Nov 2019, at 14:58, Dan Kennedy wrote: > > No, they don't need to handle that. The rows will always be added/removed in > ORDER BY order for all window functions (and will be removed in the same > order in which they were added if the ORDER BY order is ambiguous). Ah, excellent!

[sqlite] Custom window functions vs builtin

2019-11-12 Thread Merijn Verstraaten
I already asked this question without an answer, but as it hidden somewhere nested deeply in another thread I think it may have simply gone under the radar. Apologies for the duplication if you already saw it! How is the behaviour of (custom) window functions defined? Specifically, in the

Re: [sqlite] Deterministic random sampling via SELECT

2019-11-08 Thread Merijn Verstraaten
On 7 Nov 2019, at 20:47, Chris Peachment wrote: > 1. generate a list of pseudo-random numbers, using a pre-defined > seed value, over the range 1 .. count(*) of records in table, > > 2. use that list as record id values to select the desired subset > of the data in the table. > > This

Re: [sqlite] Deterministic random sampling via SELECT

2019-11-07 Thread Merijn Verstraaten
> On 7 Nov 2019, at 19:16, David Raymond wrote: > > Along those lines SQLite includes the reverse_unordered_selects pragma > https://www.sqlite.org/pragma.html#pragma_reverse_unordered_selects > which will flip the order it sends rows in queries that don't explicitly > specify an ordering.

[sqlite] Deterministic random sampling via SELECT

2019-11-07 Thread Merijn Verstraaten
I'm trying sample a (deterministically) random subset of a SELECT query, the most common solution on the internet to get random samples seems to be "SELECT * FROM (...) ORDER BY RANDOM() LIMIT n;" (this already has some question marks, since it relies on seeding RANDOM and knowing the RANDOM