[postgis-users] Function question

Simon SPDBA Greener simon at spdba.com.au
Mon Mar 14 23:40:54 PDT 2022


Fellow PostGISers,

I have two environments.

select  Version()
*       "PostgreSQL 10.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 
4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit"*
select PostGIS_Full_Version()
*       "POSTGIS=""2.5.3 r17699"" [EXTENSION] PGSQL=""100"" 
GEOS=""3.8.0-CAPI-1.13.1 "" PROJ=""Rel. 6.2.1, November 1st, 2019"" 
GDAL=""GDAL 3.0.2, released 2019/10/28"" LIBXML=""2.9.1"" 
LIBJSON=""0.11"" LIBPROTOBUF=""1.0.2"" RASTER"*

And.

*"PostgreSQL 13.3, compiled by Visual C++ build 1914, 64-bit"**
**"POSTGIS=""3.1.2 3.1.2"" [EXTENSION] PGSQL=""130"" 
GEOS=""3.9.1-CAPI-1.14.1"" SFCGAL=""1.3.8"" PROJ=""7.1.1"" 
LIBXML=""2.9.9"" LIBJSON=""0.12"" LIBPROTOBUF=""1.2.1"" WAGYU=""0.5.0 
(Internal)"" TOPOLOGY"*

I have written the following function:

CREATE OR REPLACE FUNCTION spdba.STSquarifyLine(p_line geometry)
  RETURNS geometry
LANGUAGE 'plpgsql'
  IMMUTABLE
  SECURITY DEFINER
AS
blah...

The function does no calculations per se, it only swaps ordinates.

PostGIS functions used are:

ST_MakeLine / ST_SetSRID ST_MakePoint ST_X / ST_Y / ST_GeomFromEWKT

The function does call another small function:

create or replace function spdba.STGeneralDirection(p_geom geometry)
returns varchar(2)
LANGUAGE 'plpgsql'
  IMMUTABLE
  SECURITY DEFINER
as
.... (It uses Uses ST_BoundingRectangle ST_X ST_Y ST_StartPoint ST_EndPoint)

This function returns the same result on both databases for a bunch of 
different inputs. Happy that it works as I wish.

However if I execute the STSquarifyLine function on the Linux box for a 
particular input, I get what I consider to be the "right" result. When I 
execute the same function with the same parameter value on the Windows 
box I do not get the same result. (I have played around with IMMUTABLE 
and VOLATILE but these make no difference.)

I know this is a bit vague but any tips as to what may be going on?

I am happy to supply the functions source (via email) if anyone is 
willing to help.

regards

Simon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220315/94ce1c79/attachment.html>
-------------- next part --------------
An embedded message was scrubbed...
From: Simon Greener <simon.greener at bigpond.com>
Subject: Function question
Date: Tue, 15 Mar 2022 17:32:24 +1100
Size: 7651
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220315/94ce1c79/attachment.eml>


More information about the postgis-users mailing list