Democracy cannot function at whims and fancies of anyone: PM