[MDEV-22823] JSON_OBJECTAGG: incorrect error message Created: 2020-06-07  Updated: 2020-06-15  Resolved: 2020-06-15

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.5
Fix Version/s: 10.5.4

Type: Bug Priority: Major
Reporter: Sergei Petrunia Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

create table t20 (a varchar(10), b int);
insert into t20 values ('red', 1), ('blue', 2), ('red',1001), ('blue', 1002);
 
select json_objectagg(a,b) over (order by a ) from t20;
ERROR 1235 (42000): This version of MariaDB doesn't yet support 'GROUP_CONCAT() aggregate as window function'

Note that error message says GROUP_CONCAT.
This is because:

class Item_func_json_objectagg : public Item_sum
{
...
  enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
  const char *func_name() const { return "json_objectagg("; }

It is also potentially bad to have sum_func() to return name of another
function, because somebody somewhere might check its value and typecast
a pointer to Item_func_group_concat to Item_func_group_concat*.



 Comments   
Comment by Alexey Botchkov [ 2020-06-15 ]

https://github.com/MariaDB/server/commit/ffc5e00e9c64d64b773178be4a4750ac1613879c

Generated at Thu Feb 08 09:17:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.