Transforming these strings into jsonb objects is relatively straightforward:
select
split_part(id, ':', 1) as id,
date,
jsonb_object_agg(split_part(param, '=', 1), split_part(param, '=', 2)) as params
from my_table
cross join unnest(string_to_array(split_part(id, ':', 2), '&')) as param
group by id, date;
Now you can use the solution described in Flatten aggregated key/value pairs from a JSONB field?
Alternatively, if you know the number and names of the parameters, this query is simpler and works well:
select
id,
date,
params->>'type' as type,
params->>'country' as country,
params->>'quality' as quality
from (
select
split_part(id, ':', 1) as id,
date,
jsonb_object_agg(split_part(param, '=', 1), split_part(param, '=', 2)) as params
from my_table
cross join unnest(string_to_array(split_part(id, ':', 2), '&')) as param
group by id, date
) s;
Test it in Db<>fiddle.
In Postgres 14+ you can replace unnest(string_to_array(...))
with string_to_table(...)
.