relay powered voltage regulator ?

The diode protects a transistor if it is used to drive the relay. When the transistor is turned off, the diode recirculates the current so high voltage is reduced as transistor opens. It protects against inductive kick. In the normal turning on, the diode is reversed biased, and has no effect then.

If wired as post #9, the diode is forward biased, it has only 0.7V of voltage drop. If 12V is applied it goes pow, and results in a dead short, if it is not blown open. Semiconductors most often fail shorted, not open.

Some may say I wired like that and it worked, that is because your particular relay does not have the diode.

TrailBeast posted correct schematic.