[postgis-devel] ST_GeneratePoints randomness

Paul Norman penorman at mac.com
Tue Jan 15 16:36:07 PST 2019


On 2019-01-15 2:10 p.m., Felix Kunde wrote:
> I'm trying to create some random spatial data using the 
> ST_GeneratePoints functions. I wanted to reuse it also for lines and 
> polygons but stumbled over the issue that multiple calls of the 
> function in one transaction produce the same result


On my PostGIS 2.3 system, st_generatepoints is declared as IMMUTABLE. 
IMMUTABLE functions will always return the same output for a given 
input, and can be optimized more. If a function is called twice in a 
statement it can then be optimized away to one call which is evaluated 
in the planning stage. Random functions should be declared as VOLATILE, 
the default.

I've opened https://trac.osgeo.org/postgis/ticket/4299 about it.





More information about the postgis-devel mailing list