Function jsonb_remove_index

Source
fn jsonb_remove_index(v: JsonbRef<'_>, index: i32) -> Result<JsonbVal>
Expand description

Deletes the array element with the specified index (negative integers count from the end). Throws an error if JSON value is not an array.

Examples:

query T
SELECT '["a", "b"]'::jsonb - 1;
----
["a"]

query T
SELECT '["a", "b"]'::jsonb - -1;
----
["a"]

query T
SELECT '["a", "b"]'::jsonb - 2;
----
["a", "b"]

query T
SELECT '["a", "b"]'::jsonb - -3;
----
["a", "b"]

query error cannot delete from scalar
SELECT '1'::jsonb - 1;

query error cannot delete from object using integer index
SELECT '{"a": 1}'::jsonb - 1;