A law that would have banned Russians from drinking beer in public has been thrown out of the country's upper house of Parliament.