As you had it, any nonzero result would prevent backtick substitution. I'm not really sure how much thought went into the existing behavior, but I am pretty sure that it's not part of this patch's charter to change that.
regards, tom lane
The changes all make sense, thanks!
This is a follow up patch to apply the committed pattern to the various piped output commands.
Following up here. This addendum patch clearly isn't as important as anything currently trying to make it in before the feature freeze, but I think the lack of setting the SHELL_ERROR and SHELL_EXIT_CODE vars on piped commands would be viewed as a bug, so I'm hoping somebody can take a look at it.