For example, here I asked a question, with a specific restriction ("without using the DateTime module"), to which I am bound. I got the answer that helped me, after which I decided that this restriction is relevant only to specific environment in which I am working, and the question will be useful for much more people without this restriction. So, I edited the question, and specified the reason for the edit in the comment. This made one of the already given answers wrong. Is my behavior OK, or should I've asked another question instead?
I would have asked a separate question. If you can catch it before anyone answers I would say that it's okay to change it. But if your changes cause someone's answer to be wrong (and potentially get downvotes for it) then I'd leave that question alone and just ask a new one. You can always link the two questions together as "Related".
If you're going to edit it like that, rather than ask another question, make it clear that you did it. You changed the question, and only mentioned the change in a comment.
Something like: "What's the best way to do foo? (Note: I originally asked for a way without bar, and some of the answers reflect that.)"
Right now, you're making somebody look bad, and possibly costing him or her rep.