sql - Touch function in Postgres with PostGis -
i have postgresql installed postgis, try run following:
select n1.edname "borders royal exchange a" eds_census2011 n1, eds_census2011 n2 touch(n1.the_geom, n2.the_geom) , n2 = 'royal exchange a'
and error (below) there have add postgres or enable something?
error: function touch(geometry, geometry) not exist line 3: touch(n1.the_geom, n2.the_geom) ^ hint: no function matches given name , argument types. might need add explicit type casts. ********** error ********** error: function touch(geometry, geometry) not exist sql state: 42883 hint: no function matches given name , argument types. might need add explicit type casts. character: 96
run these 2 queries (in same session trying above query) pin down problem:
in schema function touch()
live?
select p.proname, n.nspname pg_proc p join pg_namespace n on n.oid = p.pronamespace proname = 'touch';
what current schema search_path
of role:
show search_path;
if function exists, schema must in current search_path
postgres can find it. how adapt search_path
?
how search_path influence identifier resolution , "current schema"
btw, can't find function touch()
in function reference of postgis manual. there 1 called st_touches(). chance meant one?
be aware query has cost of o(n²), since calculates value every combination of 2 qualifying rows in eds_census2011
. if condition n2.edname = 'royal exchange a'
selective enough, won't problem.
also, may want exclude rows joining additional where
item like:
and n1.pk_id <> n2.pk_id
error after update
your updated query makes more sense:
select n1.edname "borders royal exchange a" eds_census2011 n1, eds_census2011 n2 st_touches(n1.the_geom, n2.the_geom)=1 , n2.edname = 'royal exchange a';
but st_touches()
returns boolean
, clause should be:
where st_touches(n1.the_geom, n2.the_geom)
Comments
Post a Comment