Closed xylle closed 2 weeks ago
Thank you for reporting this, @xylle !
I proposed a fix for this in the sql parser we are using: https://github.com/apache/datafusion-sqlparser-rs/pull/1493 We are now just waiting for it to be merged and for a new version of the parser to be released.
In the meantime, you can use a window function instead to count row numbers:
SELECT
jt.*,
row_number() OVER () AS row_num
FROM JSON_TABLE(
'["Alice", "Bob", "Charlie"]',
'$[*]' COLUMNS(
name VARCHAR(50) PATH '$')
) AS jt
I was trying to understand how JSON works. SQL and JSON are obscure to me. Thanks
The fix was merged in the sql library. It's coming soon to sqlpage
I just updated the SQL parser. This is fixed :)
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
Actual behavior
Not working.
Screenshots
Expected behavior
Version information