It would seem like what you're asking for is to continue until the commit of the parent transaction, not just the next commit after the subcommit. Otherwise (if that's an unrelated xact) the subxact would still not be committed, so that you might as well have stopped short of it.
Right, the parent transaction is what I meant.
I'd be in favor of that for recovery_target_xid, but I'm not at all convinced about changing the behavior for a target LSN. The fact that the target is a subcommit seems irrelevant when you specify by LSN.
Perhaps some context will help. There have been 2 cases in which I have tried to do this, both of them based on logical decoding, and finding either a transaction id or an LSN to recover to. Actually, the only reason I have ever used transaction id instead of LSN is on <= 9.6 because the latter isn't supported until pg10.
For this use case, my goal is simply to be able to recover the the point immediately after a particular decoded log line is visible, without necessarily having to find out the final parent transaction id.
Given this, I am open to different implementations but I would like to either be able to specify an LSN or transaction ID, and have a feature that allows the recovery target to roll forward just until it is visible, even if the LSN or transaction ID is not the actual commit of the parent transaction.
I don't recall this for sure, but doesn't a parent xact's commit record include all subxact XIDs? If so, the implementation would just require searching the subxacts as well as the main XID for a match to recovery_target_xid.