Note: Vue postgres depuis du json
2018-06-07T11:57:18+02:00-- contenu du json de mon_champ_json :
-- { {"champ1":"azerty","champ2":"azerty"}, {"champ1":"azerty","champ2":"azerty"} }
CREATE TYPE json_type_<mon_champ_json> AS(
"champ1" character varying(255),
"champ2" character varying(255),
...
);
DROP VIEW IF EXISTS v_<ma_vue>;
create view v_<ma_vue> as
SELECT t.id, j.*
FROM ma_table t, json_populate_recordset(null::json_type_<mon_champ_json>, t.<mon_champ_json>::json) j;
— Permalink
-- { {"champ1":"azerty","champ2":"azerty"}, {"champ1":"azerty","champ2":"azerty"} }
CREATE TYPE json_type_<mon_champ_json> AS(
"champ1" character varying(255),
"champ2" character varying(255),
...
);
DROP VIEW IF EXISTS v_<ma_vue>;
create view v_<ma_vue> as
SELECT t.id, j.*
FROM ma_table t, json_populate_recordset(null::json_type_<mon_champ_json>, t.<mon_champ_json>::json) j;
— Permalink