Turning geomhashstring.sql into a function