postgrespro / pgsphere

PgSphere provides spherical data types, functions, operators, and indexing for PostgreSQL.
https://pgsphere.org
BSD 3-Clause "New" or "Revised" License
16 stars 14 forks source link

Add function to create spoly from an array of numbers in radians #96

Closed esabol closed 11 months ago

esabol commented 11 months ago

As discussed in issue #95, this pull request adds a constructor function to create an spoly from an array of numbers in radians. It is very similar to spoly_deg() except without the calls to deg_to_rad().

Question 1: Can the spoly(float8[]) function be marked PARALLEL SAFE? My reading of the documentation for PARALLEL SAFE doesn't mention anything about accessing arrays or allocating memory, so I think it should be.

Question 2: Can it be marked STRICT? select spoly(NULL::float8[]) returns null, I believe.

If the answer to either or both questions, I would like to make the same change(s) to spoly_deg also.

df7cb commented 11 months ago

I believe the answer to both question is "yes".

Mind that besides the parameter being NULL, individual array elements might also be NULL.

vitcpp commented 11 months ago

@esabol I think, everything ok except of some trivial formatting changes. Thank you!

vitcpp commented 11 months ago

@esabol I'm ok to accept the patch. Could you please squash the commits?

esabol commented 11 months ago

Rebased and squashed. Ready to merge whenever you are. Thank you for your reviews, @vitcpp !

vitcpp commented 11 months ago

It seems I'm the only reviewer. Lets merge it, since the risks to break the pgpshere are minimal.