3647
MariaDBERRORNotableQueryHIGH confidence

JSON_TABLE column or nested path requires an alias (variant 2)

Production Risk

Low — Query fails at parse time.

How to reproduce
trigger — this will error
trigger — this will error
SELECT * FROM JSON_TABLE(doc, '
#x27; COLUMNS (NESTED PATH '$.items[*]' COLUMNS ())) jt;

expected output

ERROR 3647 (HY000): JSON_TABLE nested path requires a column alias.

Fix

Add column aliases in nested path

Add column aliases in nested path
SELECT * FROM JSON_TABLE(doc, '
#x27; COLUMNS (NESTED PATH '$.items[*]' COLUMNS (item_id INT PATH '$.id'))) jt;

Why this works

Provides a named column for the nested path extraction.

What not to do

Version notes

Sources
Official documentation ↗

MySQL 8.0 — 3647 ER_JSON_TABLE_ALIAS_REQUIRED2

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors