3155
MySQLWARNINGCriticalJSONHIGH confidence

JSON_TABLE: multiple matches found for column path

Production Risk

Medium — silent data loss if additional matches are expected.

What this means

A JSON_TABLE column path matched multiple values in the JSON document but only the first match is used. A warning is issued to alert the user to the unexpected multiple matches.

Why it happens
  1. 1The JSON path expression for a scalar column is ambiguous and matches more than one node.
How to reproduce
trigger — this will error
trigger — this will error
SELECT jt.* FROM JSON_TABLE('{"a":[1,2]}', '
#x27; COLUMNS(val INT PATH '$.a[*]')) AS jt;

expected output

Warning (Code 3155): JSON_TABLE: Multiple matches found for column path, only the first match is used.

Fix

Make the path unambiguous or use NESTED PATH

Make the path unambiguous or use NESTED PATH
SELECT jt.* FROM JSON_TABLE('{"a":[1,2]}', '
#x27; COLUMNS(NESTED PATH '$.a[*]' COLUMNS(val INT PATH '
#x27;))) AS jt;

Why this works

NESTED PATH expands all matches into separate rows rather than discarding them.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3155 ER_JSON_TABLE_MULTIPLE_MATCHES

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

← All MySQL errors