3645
MariaDBERRORNotableQueryHIGH confidence

JSON_TABLE must have an alias

Production Risk

Low — Query fails at parse time.

How to reproduce
trigger — this will error
trigger — this will error
SELECT v FROM JSON_TABLE('[{"a":1}]', '$[*]' COLUMNS (v INT PATH '$.a'));

expected output

ERROR 3645 (HY000): JSON_TABLE must have an alias.

Fix

Add table alias

Add table alias
SELECT v FROM JSON_TABLE('[{"a":1}]', '$[*]' COLUMNS (v INT PATH '$.a')) AS jt;

Why this works

Provides the required alias for the JSON_TABLE function.

What not to do

Version notes

Sources
Official documentation ↗

MySQL 8.0 — 3645 ER_JSON_TABLE_COLUMN_MUST_HAVE_ALIAS

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

← All MariaDB errors