Closed esabol closed 7 months ago
@esabol I think, it is possible what you proposes. Postgresql supports function overloading.
I propose to complete your PR and then try to implement spoly(spoint[]) as another PR.
How would you advise implementing the spoly(spoint[])
constructor function?
Would the spoint array need to be duplicated in memory (using the equivalent of a copy constructor)? Or can you reuse the same array and/or the same array members passed in as arguments?
It feels like there should be some trick to creating an spoly
from an array of spoints since you can sort of already do the following in PLpgsql:
select spoly(t.pnt)
into thepoly
from (select pnt from xxxpnts order by ord) as t;
How would you advise implementing the
spoly(spoint[])
constructor function?
I will propose an implementation. May be tomorrow.
@esabol I think, this issue is completed with the following PRs:
The
spoly_deg()
function can construct aspoly
from an array offloat8
:(Aside: Why is this function not PARALLEL SAFE? Should it be?)
But there's no corresponding
spoly
constructor that takes an array offloat8
in radians:I don't want to use a temporary table to construct a
spoly
in my PLpgsql functions. It's horribly inefficient and doesn't scale when operating over very large tables. So that means I have to either convert my coordinates to degrees (only forspherepoly_deg()
to convert them back to radians) in order to avoid that or construct a string to contain the array of coordinates and use thespoly
constructor on the string.Also, I think it would be nice if there was a constructor that takes an array of
spoint
as well, so that you can do this:Should that be possible? What do you think?