Potatoes turn green when they are exposed to the light for a prolonged time. The green colour comes from chlorophyll, which is safe on its own. However, potatoes, exposed produce a nasty substance called solanine (glycoalkaloid). Our organism can tolerate it in low concentrations, but in green potatoes solanine concentration can reach 100mg/100g (in 'normal' potatoes - 2-15mg/100g). The safety limit (the maximum level of substance, that can be ingested without undesirable effects) is 200 mg per kg of the bodyweight.
The symptoms of solanine poisoning include abdominal pain, vomiting and neurological impairment, depending on the amount ingested.
Potatoes with solanine concentration above 20mg/100g taste bitter, which is a good way to check if a potato is safe to eat. Since solanine concentrated mainly just underneath the potato skin, it is possible but not advisable to peel it off and still be able to make that cottage pie :)