That's right, it is Solanum nigrum. It's true that in many parts of the world, people eat the boiled leaves and the ripe berries. But apparently, the plants vary a lot in toxicity, and it would be difficult to know what "strain" of black nightshade you have there. I would be careful about eating this plant, maybe try only a small amount of completely ripe berries or thoroughly boiled leaves, and see if you notice any unwanted side effects.
If anyone else is wondering, the vining plant Solanum dulcamara (bittersweet nightshade), isn't edible despite having vaguely similar berries.
Lisa Millbank