On Wednesday, September 8, 2021, Dave Cramer <davecramer@postgres.rocks> wrote:
I'd like to add a test case that would break otherwise,
Seems like munging OIDs on system tables would be outside what the test environment would be reasonably capable of doing, though I’m not familiar with whether you can mock the server and stub out a resultset response to the query that would contain multiple records. The error mode is not returning exactly one record. Testing for that at runtime is simple, but what is a good response if that unlikely event happens?
I don’t know if it is even possible for a stock install to have two OIDs globally duplicated - though it isn’t hard to check for on a given server. Creating thousands of tables, or types, or whatnot on said server until a global duplicate appears would be fairly straight-forward, if potentially time and, to a lesser extent (drop table et al.) space consuming. Probably worth doing for adhoc testing but less so in a unit test suite.
David J.