Full threadprima-facie·PostgRest allows doing something very similar to this but in a safer way: https://postgrest.org/View on HN