How to fix a pinhole leak in water main inside my house?
Iron or copper pipe?

Corrosion inside metal pipes forms craters that eventually open a pinhole and as the metal erodes due to corrosion compromise and water flow, they get larger.

From experience, if you have one pinhole, you have several incipient corrosion craters that will eventually leak elsewhere in the segment. You can patch them one at a time for expedience, but eventually you're going to redo the whole length.