Hello! How to write a function, for example convert_json_to_columns, which converted data from JSONB format so that you can use the output parameters as a sample of columns for the query
select (SELECT convert_json_to_columns ('[{"cmp": "id", "cmp": "name", "cmp": "ean13"}]] :: :: jsonb)) from cmp
to end up with select cmp.id, cmp.name, cmp.ean13 from cmp