Replacing a JSON array element requires an existing path. A missing coordinate calls for a separate insert or set policy.
Worked example
SELECT json_replace('[2,4,8]','$[1]',6) AS point;Result
[
{
"point": "[2,6,8]"
}
]Implementation notes
JSON functions return a new value. Updating a stored document also requires an UPDATE statement targeting the intended row.
Try it yourself
Try a three-element vector and a shorter vector with the same update path.
Open the SQL example →Editorial date November 14, 2025 · Published December 6, 2026