Created
May 23, 2013 01:25
-
-
Save andrewxhill/5632177 to your computer and use it in GitHub Desktop.
Polygon insert Named Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create a function withn the security set to Definer so that it can insert | |
CREATE OR REPLACE FUNCTION AXH_NewMinneapolis(integer, geometry) RETURNS integer | |
AS 'INSERT INTO minneapolis (parent_id, the_geom) (SELECT id, geom FROM (SELECT $1 id,$2 geom) a WHERE ST_NPoints(geom) < 100) RETURNING cartodb_id;' | |
LANGUAGE SQL | |
SECURITY DEFINER | |
RETURNS NULL ON NULL INPUT; | |
--Grant access to the public user | |
GRANT EXECUTE ON FUNCTION AXH_NewMinneapolis(integer, geometry) TO publicuser; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment