The patch looks correct. It adds `pub` records, but not all of them, since field 12 (key capabilities) is filtered to include only keys with `e` (the encrypt capability). It is interesting to note that the filter on field 12 seems sufficient, which makes the filter on field 1 (type of record) redundant (though good for clarity of intent).
On Thu, 13 Apr 2023, at 21:39, Axel Beckert wrote: > So I came up with the attached patch which does not only filter the > list of target keys for subkeys but also for public keys. The > remainder seems to still work as intended: Having two keys with > subkeys and one without, there are not five key ids (pub and sub) in > gpg_keys but still only the expected three.
