using appropriate operators in format function

This commit is contained in:
Andy Eschbacher 2016-05-12 15:13:50 -04:00
parent e74964c1ee
commit 02a4dbde57

View File

@ -72,9 +72,9 @@ BEGIN
-- return the first boundary in intersections -- return the first boundary in intersections
EXECUTE format( EXECUTE format(
'SELECT t.the_geom 'SELECT the_geom
FROM observatory.%s As t FROM observatory.%I
WHERE ST_Intersects($1, t.the_geom) WHERE ST_Intersects($1, the_geom)
LIMIT 1', target_table) LIMIT 1', target_table)
INTO boundary INTO boundary
USING geom; USING geom;
@ -223,9 +223,9 @@ BEGIN
-- retrieve boundary -- retrieve boundary
EXECUTE EXECUTE
format( format(
'SELECT t.%s 'SELECT %I
FROM observatory.%I As t FROM observatory.%I
WHERE t.%s = $1 WHERE %I = $1
LIMIT 1', geom_colname, target_table, geoid_colname) LIMIT 1', geom_colname, target_table, geoid_colname)
INTO boundary INTO boundary
USING geometry_id; USING geometry_id;
@ -281,9 +281,9 @@ BEGIN
-- return first boundary in intersections -- return first boundary in intersections
RETURN QUERY RETURN QUERY
EXECUTE format( EXECUTE format(
'SELECT t.%s, t.%s 'SELECT %I, %I
FROM observatory.%s As t FROM observatory.%I
WHERE ST_%s($1, t.the_geom) WHERE ST_%s($1, the_geom)
', geom_colname, geoid_colname, target_table, overlap_type) ', geom_colname, geoid_colname, target_table, overlap_type)
USING geom; USING geom;
@ -423,9 +423,9 @@ BEGIN
-- return first boundary in intersections -- return first boundary in intersections
RETURN QUERY RETURN QUERY
EXECUTE format( EXECUTE format(
'SELECT ST_PointOnSurface(t.%s) As %s, t.%s 'SELECT ST_PointOnSurface(%I) As %s, %I
FROM observatory.%s As t FROM observatory.%I
WHERE ST_%s($1, t.the_geom) WHERE ST_%s($1, the_geom)
', geom_colname, geom_colname, geoid_colname, target_table, overlap_type) ', geom_colname, geom_colname, geoid_colname, target_table, overlap_type)
USING geom; USING geom;