Skip to content

Error with json_table in mariadb. #658

Closed
@xylle

Description

@xylle

Introduction

Error with json_table in mariadb.

To Reproduce

Query work correctly with phpmyadmin. The SQL code comes from the page : https://sql.datapage.app/blog.sql?post=JSON%20in%20SQL%3A%20A%20Comprehensive%20Guide

SELECT jt.*
FROM JSON_TABLE(
  '["Alice", "Bob", "Charlie"]',
  '$[*]' COLUMNS(
    row_num FOR ORDINALITY,
    name VARCHAR(50) PATH '$'
  )
) AS jt;

Actual behavior

Not working.

[2024-10-30T15:31:47.813Z ERROR sqlpage::render] SQL error: Parsing failed: SQLPage couldn't understand the SQL file. Please check for syntax errors:

      '$[*]' COLUMNS(
        row_num FOR ORDINALITY,
                   ⬆️
        name VARCHAR(50) PATH '$'


    Caused by:
        0: sql parser error: Expected: PATH, found: ORDINALITY at Line: 40, Column: 17
        1: SQLPage could not parse and prepare this SQL statement

Screenshots

Screenshot 2024-10-30 at 16-33-01 Serveurs 2

Expected behavior

row_num name
1 Alice
2 Bob
3 Charlie

Version information

  • OS : Windows 10
  • Database : Mariadb
  • SQLPage Version : 0.29.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions