Created
March 31, 2020 16:27
-
-
Save geobabbler/98d8c15cdea6f526d2c9c59d9ac3e567 to your computer and use it in GitHub Desktop.
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 OR REPLACE FUNCTION public.jhu_county_watched() | |
RETURNS trigger AS | |
$BODY$ | |
DECLARE | |
BEGIN | |
PERFORM pg_notify('jhucounty', '{"type": "Feature", "geometry": ' || | |
st_asgeojson(NEW.wkb_geometry) || | |
',"properties": {"message": "' || | |
'update' || '",' || | |
'"fips": "' || NEW.fips || '",' || | |
'"label": "' || NEW.combined_key || '",' || | |
'"confirmed": "' || NEW.confirmed || '",' || | |
'"last_update": "' || NEW.last_update || '"' || | |
'}}' ); | |
RETURN new; | |
END; | |
$BODY$ | |
LANGUAGE plpgsql VOLATILE | |
COST 100; | |
ALTER FUNCTION public.jhu_county_watched() | |
OWNER TO postgres; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment