← Back to team overview

maria-developers team mailing list archive

Review for: MDEV-17399 Add support for JSON_TABLE, part #7

 

Hi Alexey,

On Thu, Jul 16, 2020 at 04:34:46PM +0400, Alexey Botchkov wrote:
> 
> In the new patch i think i addressed most of your comments.
> https://github.com/MariaDB/server/commit/d3a311a8e9508ef94dddb6b7f4d366337a9fd64a
> 
...

> > The above doesn't do proper quoting, which is wrong. Testcase:
> >
> > select *
> > from
> >   json_table('[{"co\\\\lor": "blue", "price": 50}]',
> >              '$[*]' columns( color varchar(100) path '$.co\\\\lor')
> >              ) as T;
> > +-------+
> > | color |
> > +-------+
> > | blue  |
> > +-------+
> >
> > create view v2 as
> > select *
> > from
> >   json_table('[{"co\\\\lor": "blue", "price": 50}]',
> >              '$[*]' columns( color varchar(100) path '$.co\\\\lor')
> >              ) as T;
> > select * from v2;

Quoting is still an issue apparently:

create view v1 as 
select *
from
  json_table('[{"color": "blue", "price": 50}]',
             '$[*]' columns(color text path '$.nonexistent',
                            seq for ordinality
                        )
             ) as `ALIAS NOT QUOTED`;
select * from v1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NOT QUOTED' at line 1


create view v2 as 
select *
from
  json_table('[{"color": "blue", "price": 50}, {"color": "red", "price": 100}]',
             '$[*]' columns(color text path '$.QUOTES " HERE "',
                            seq for ordinality
                        )
             ) as T;
select * from v2;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'HERE "", `seq` FOR ORDINALITY)) T' at line 1


Could you please go through the printout functions and make sure all printed
literals are properly escaped/quoted?

Printout code for other functions can be used as an example.

BR
 Sergei
-- 
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog




Follow ups

References