. . . the comparable number of accounts reporting that these species [Solanum nigrum] are harmless as food and fodder sources suggest that this toxicity is variable. Indeed a chemical suvey of various members of the section Solanum reported the presence of potentially toxic alkaloids only in unripe fruits, with ripe berries and vegetative parts tacking these compounds. Shilling et al. (1992) therefore concluded that the plants are probably only poisonous to indiscriminate feeders such as livestock who might consume the whole plant. However, these plants are browsed and used as fodder for animals without any detrimental effect in some areas, and Rogers and Ogg (1981) suggested that the development of toxic levels of these alkaloids is dependent on their growth under certain conditions or in certain localities, and even on the age of the plants concerned. Other reports suggest that the amounts of poisonous princinples vary greatly with climate, season and soil type (Cooper and Johnson 1984). It is highly probable that boiling destroys any toxicity inherent in these species; most ethonobotanical reports of their use as vegetables refer to cooking, boiling and even repeated boiling with the liquid being discarded; similar reports of the use of berries also refer to their being poisonous when uncooked or unripe. Drying, however, does not destroy the toxicity of the solamine-type alkaloids (Everist 1974). It is these glycosidal alkaloids which are responsible for the bitter taste often associated with the Solanums.
http://www.rootsimple.com/2011/11/deadly-nightshade-vs-black-nightshade/