Problem: I have to set IntervalStyle in separate statement to convert interval type to ISO8601 string.
This isn't well supported by ORMs or similar tools, requiring us to set it globally (per role or per database). Problem #2 (exotic): you can't mix two output styles in a single query. Proposed solution: special case to_char function to accept values accepted by SET intervalstyle to 'XYZ' So: SELECT to_char(INTERVAL '8 minutes', 'iso_8601') will act similar to SET intervalstyle TO 'iso_8601'; SELECT (INTERVAL '8 minutes')::text RESET interval_style;