Created
January 28, 2016 22:28
-
-
Save ajashton/5763986633b466b2b459 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
-- Instance of ST_AsText that can handle an array of geometries | |
create or replace function ST_AsText(geometry[]) | |
returns text | |
language plpgsql immutable as | |
$$ | |
declare | |
g geometry; | |
res text := '{'; | |
begin | |
if $1 is null or array_length($1, 1) = 0 then | |
return '{}'; | |
end if; | |
foreach g in array $1 loop | |
res := res || ST_AsText(g) || ', '; | |
end loop; | |
return trim(trailing ', ' from res) || '}'; | |
end; | |
$$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment