Re: [sqlite] JSON_GROUP_ARRAY unexpected misuse error in UPDATE

2020-01-10 Thread Keith Medcalf
irway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users On >Behalf Of Keith Medcalf >Sent: Friday, 10 January, 2020 18:07 >To: SQLite mailing list >Subject: Re: [sqlite] JSON_GROUP_ARRAY unexpected misuse error in UPDATE &g

Re: [sqlite] JSON_GROUP_ARRAY unexpected misuse error in UPDATE

2020-01-10 Thread Keith Medcalf
On Friday, 10 January, 2020 14:35, Jason Dora wrote: >I have a workflow where I would like to push an item onto a JSON array, >while ensuring the items on the array are unique. And I'm able to write a >working statement in a SELECT, but the same logic fails in a UPDATE. You need to define what

[sqlite] JSON_GROUP_ARRAY unexpected misuse error in UPDATE

2020-01-10 Thread Jason Dora
Hello SQLite masters, I have a workflow where I would like to push an item onto a JSON array, while ensuring the items on the array are unique. And I'm able to write a working statement in a SELECT, but the same logic fails in a UPDATE. Assume there is a table named "users" with the columns UserI

Re: [sqlite] json_group_array( json_object())

2019-07-05 Thread ingo
On 5-7-2019 20:14, Richard Hipp wrote: > Can you please send a complete example? While preparing that the problem was resolved. A search showed that a wrong concatenation || further down caused this result. Something I noticed before when working with json is that my errors in the code result

Re: [sqlite] json_group_array( json_object())

2019-07-05 Thread Richard Hipp
On 7/5/19, ingo wrote: > The following: > > json_object ( > 'data', json_group_array( > json_object( >'type', type, >'id', notebook_id, >'attributes', json_object( > 'book', book, > 'total_notes', total_notes >), ...etc > > results in: > >

[sqlite] json_group_array( json_object())

2019-07-05 Thread ingo
The following: json_object ( 'data', json_group_array( json_object( 'type', type, 'id', notebook_id, 'attributes', json_object( 'book', book, 'total_notes', total_notes ), ...etc results in: {"data":"[{\"type\":\"notebook\",\"id\":2,\"attrib

[sqlite] json_group_array() and sorting

2019-01-08 Thread Eric Grange
Hi, Is json_group_array() supposed to honor a sorting clause or not ? (and concatenation aggregates in general) I have a query like select json_group_array(json_object( 'id', st.id, 'num', st.numeric_field, ...bunch of fields here... )) from some_table st ...bunch of joins here... where

[sqlite] json_group_array

2016-02-06 Thread Michael Falconer
nique values where NULLs are not distinct. > > and so on and so forth > > > -Original Message- > > From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users- > > bounces at mailinglists.sqlite.org] On Behalf Of R Smith > > Sent: Friday, 5 February,

[sqlite] json_group_array

2016-02-05 Thread Hick Gunter
mailinglists.sqlite.org] Im Auftrag von Yannick Duch?ne Gesendet: Freitag, 05. Februar 2016 12:38 An: sqlite-users at mailinglists.sqlite.org Betreff: Re: [sqlite] json_group_array On Fri, 5 Feb 2016 07:51:06 + Hick Gunter wrote: > That is because count(a) and count(*) means two differ

[sqlite] json_group_array

2016-02-05 Thread Keith Medcalf
o: sqlite-users at mailinglists.sqlite.org > Subject: Re: [sqlite] json_group_array > > > > On 2016/02/05 6:34 AM, TJ O'Donnell wrote: > > I can't argue for the correctness of including nulls in aggregate > functions > > or not. > > It truly is an arbitra

[sqlite] json_group_array

2016-02-05 Thread Yannick DuchĂȘne
On Fri, 5 Feb 2016 07:51:06 + Hick Gunter wrote: > That is because count(a) and count(*) means two different things. The first > counts values, the second counts rows. What if all columns of a row, are NULL? -- Yannick Duch?ne

[sqlite] json_group_array

2016-02-05 Thread Stephan Beal
On Fri, Feb 5, 2016 at 11:23 AM, J Decker wrote: > - > var array = [1,2,,3]; > console.log( JSON.stringify( array ) ); > - > outut : [1,2,null,3] > ... > So seems like having null in array for JSON is perfectly expected. > See also: http://stackoverflow.com/questions/3058555

[sqlite] json_group_array

2016-02-05 Thread R Smith
On 2016/02/05 6:34 AM, TJ O'Donnell wrote: > I can't argue for the correctness of including nulls in aggregate functions > or not. > It truly is an arbitrary decision meant for standards-makers. Yet, most > aggregate > function do not include nulls. Interestingly, some SQL's do include them > i

[sqlite] json_group_array

2016-02-05 Thread Hick Gunter
nnell Gesendet: Freitag, 05. Februar 2016 05:34 An: Richard Hipp Cc: SQLite mailing list Betreff: Re: [sqlite] json_group_array I can't argue for the correctness of including nulls in aggregate functions or not. It truly is an arbitrary decision meant for standards-makers. Yet, most aggregate funct

[sqlite] json_group_array

2016-02-05 Thread J Decker
I think maybe it would be more appropriate to return a blank element. It would fill an index point, but be skipped and unused in cases of iterating the loop... http://www.2ality.com/2013/07/array-iteration-holes.html Was thinking that javascript forEach et al. methods skipped null (or undefined a

[sqlite] json_group_array

2016-02-04 Thread TJ O'Donnell
I can't argue for the correctness of including nulls in aggregate functions or not. It truly is an arbitrary decision meant for standards-makers. Yet, most aggregate function do not include nulls. Interestingly, some SQL's do include them in count() but sqlite does not. In my example table, sele

[sqlite] json_group_array

2016-02-04 Thread Richard Hipp
On 2/4/16, TJ O'Donnell wrote: > I was expecting the json_group_array aggregate function to leave out null, > behaving like other aggregate functions. Is this to be expected? > > sqlite> create table x (a integer); > sqlite> insert into x values (1), (2), (null),(4); > sqlite> select group_concat

[sqlite] json_group_array

2016-02-04 Thread TJ O'Donnell
I was expecting the json_group_array aggregate function to leave out null, behaving like other aggregate functions. Is this to be expected? sqlite> create table x (a integer); sqlite> insert into x values (1), (2), (null),(4); sqlite> select group_concat(a), json_group_array(a) from x; group_conc