\set ECHO none
\pset format unaligned

CREATE TABLE result_choose AS SELECT
  city, choose(position) AS position, sr_formula(choose(position), 'personnel_name') AS formula
FROM personnel
GROUP BY city;

SELECT remove_provenance('result_choose');
SELECT city, position, formula FROM result_choose ORDER BY city;

DROP TABLE result_choose;
