From cbbcc2618fe6bb79a8d7ddfb84c806d90631ff33 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 23 Nov 2013 13:31:29 +0100 Subject: [PATCH] make classtype table update work when special schemas are used patch from https://trac.openstreetmap.org/ticket/5037 --- sql/functions.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/functions.sql b/sql/functions.sql index 4670a71f..73aa4fee 100644 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -1245,7 +1245,7 @@ BEGIN -- Note: won't work on initial import because the classtype tables -- do not yet exist. It won't hurt either. classtable := 'place_classtype_' || NEW.class || '_' || NEW.type; - SELECT count(*)>0 FROM pg_tables WHERE tablename = classtable INTO result; + SELECT count(*)>0 FROM pg_tables WHERE tablename = classtable and schemaname = current_schema() INTO result; IF result THEN EXECUTE 'INSERT INTO ' || classtable::regclass || ' (place_id, centroid) VALUES ($1,$2)' USING NEW.place_id, ST_Centroid(NEW.geometry); @@ -1987,7 +1987,7 @@ BEGIN -- remove from tables for special search classtable := 'place_classtype_' || OLD.class || '_' || OLD.type; - SELECT count(*)>0 FROM pg_tables WHERE tablename = classtable INTO b; + SELECT count(*)>0 FROM pg_tables WHERE tablename = classtable and schemaname = current_schema() INTO b; IF b THEN EXECUTE 'DELETE FROM ' || classtable::regclass || ' WHERE place_id = $1' USING OLD.place_id; END IF; -- 2.39.5