In any case the more idiomatic way of writing your query these days (since 9.4 came out) is:SELECT *FROM pg_constraint pcLEFT JOIN LATERAL generate_series(1, case when contype in ('f','p','u') then array_upper(pc.conkey, 1) else 0 end) gs ON true;
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных