[snip]
> Another way is a subselect:
>
> select coalesce((select id from map where name = 'foo'), -1);
Then why not:
select coalesce((select id from map where name = 'foo' limit 1), -1);
This should work even if there are more rows with foo.
>
> but this one will actively blow up if there are multiple 'foo' rows,
> so it doesn't solve that problem either.
>
> regards, tom lane
>