Suppose I have the following data
WITH test(id, data) AS (
VALUES
(1, '{"key1": "Some text"}'::jsonb),
(2, '{"other_key": "Some longer text"}'::jsonb),
(3, '{"key_3": "Short"}'::jsonb)
)
select ??? from test;
Note that the JSON data is simple key-value data. The key can be anything, the value is always a String.
I want to return the maximum number of characters of the value field. 16 in this case, select length('Some longer text');