Check number of parameters in RAISE statement at compile time.

The number of % parameter markers in RAISE statement should match the number
of parameters given. We used to check that at execution time, but we have
all the information needed at compile time, so let's check it at compile
time instead. It's generally better to find mistakes earlier.

This is cherry-picked c1008f0037ec9c738127c2fa6d7f6c88d885f45f from the 9.5
branch.