postgres: fix nesting