Given the following table and data:
CREATE TABLE test (
slots jsonb
);
INSERT INTO test VALUES ('{"0": {"tag": "abc", "info": "xyz"}, "1": {"tag": "def", "info": "uvw"}}');
SELECT slots FROM test;
Now I want to delete the "1" key/value entirely. I can set it to null as follows:
UPDATE test SET slots['1'] = null;
SELECT slots FROM test;
But this returns:
{"0": {"tag": "abc", "info": "xyz"}, "1": null}
Whereas I want it to return:
{"0": {"tag": "abc", "info": "xyz"}}
What is the command/syntax to achieve this?