4 ms·
In case it saves anyone a headache: Pivoting with Postgres’ JSON features (json_build_object and json_object_agg, specifically) is usually less difficult than c
by wswope 3y ago
In case it saves anyone a headache: Pivoting with Postgres’ JSON features (json_build_object and json_object_agg, specifically) is usually less difficult than crosstab IME.
I’ve used it for exactly this same sorta metadata logging.
- singingfish 3y agoInteresting, thanks! On a similar but unrelated note, I think instead of MERGE INTOs, self-updating CTEs are a better bet for similar reasons.