If I plug in my pedal and I hit a key, it will hold the note without my foot on the pedal. How do I fix this?
There are two types of switches; normally open and normally closed.
The normally open switch only makes contact between the two wires when it is pressed. The normally closed switch makes contact with the wires until it is pressed.
Likely your keyboard is expecting one type of foot switch and you are using the other. It is also possible that your keyboard (like mine) is smart enough to recognize which type is plugged in when it is turned on.
Before you do anything else, turn the keyboard off and back on making sure you are not pressing the foot switch when you turn the keyboard on. If it still behaves the same, you will need to either get a new foot switch or re-wire the old one.
As far as I can tell from a bit of research on Google, the Roland D-20 expects the normally open type.
I found this one at guitarcenter.com for $6. It says it has a "CK / RY polarity switch" to work with "virtually any keyboard", so I assume it will work with the D-20.
You pedal is reverse polarity in relation to your keyboard. If you specify what brand of sustain pedal you have, we can tell you how to remedy it.
Essentially, Roland, Korg, and Yamaha utilize pedals that are the reverse polarity of E-Mu, Ensoniq, Sequential, etc. Many, many keyboards have switchable polarity as do many sustain pedals. The D-20, if I'm not mistaken, does not have switchable polarity, so if you can tell me what make and model your pedal is, I can tell you if it is switchable. I could probably even tell you how to open it up and change the polarity, but it's usually cheaper in terms of opportunity cost to buy a different one.