Passing the table as a parameter
问题 I have to convert from lat and long to geom to use PostGIS. My problem, I have various tables from different locations and I want to pass the table as a parameter to the function. I'm trying this: CREATE or REPLACE FUNCTION convert_from_lon_lat(float,float,character varying) RETURNS integer AS $$ select id from $3 as vertices order by vertices.geom <-> ST_SetSrid(ST_MakePoint($1,$2),4326) LIMIT 1; $$ LANGUAGE SQL; but I get a syntax error. EDIT1: So I changed the previous code to this: CREATE