4304r if_exists == 'fail' should actually work

#4304 rebased and passes travis.

cc @y-p