In addition to what Borek mentioned, Mg ≠ Mg2+ (which is the form of magnesium in magnesium carbonate)
The color in a flame test depends on the electronic structure of the substance in question. Mg metal and Mg2+ ions have different electron configurations, so they will behave very differently in a flame test.
Metallic Magnesium is used fireworks to produce a bright white light,
That's what happens when Magnesium combines with Oxygen.
It's not possible though to burn the resulting ash in more Oxygen and get more light.
Interesting question. In the spectrum of the sun, there are prominent absorption lines in the green due to Magnesium. I don't know why we don't observe them in flame spectra.
I would guess the white light emitted by burning magnesium is due to the thermal emission from the solid magnesium oxide formed.
Compare this to the intense emitted by calcium oxide (limelight!).