Complément : Compositions avec JSON_TO_RECORDSET
Complément : Convertir un tableau d'objets JSON en relationnel : opérateur JSON_TO_RECORDSET (à partir de Postgres 11)
1
SELECT a.* FROM JSON_TO_RECORDSET(jsonatt) a (a1 type1, a2, type2...)
Les attributs JSON à projeter en attribut relationnel doivent être explicitement mentionnés et typés.
1
SELECT p.nom, p.prénom, ad.*
2
FROM personne p, JSON_TO_RECORDSET(adresse) ad (numéro INTEGER, rue TEXT, ville TEXT);
1
nom | prénom | numéro | rue | ville
2
--------+----------+--------+------------------+-----------
3
Holmes | Sherlock | 221 | rue du boulanger | Compiègne
4
Holmes | Sherlock | 0 | rue Secrète | Compiègne
5
Watson | John | 221 | rue du boulanger | Compiègne