Skip to content

[ISSUE-7] Added PARALLEL SAFE mark to pgSphere functions #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PGSPHERE_VERSION = 1.2.1
PGSPHERE_VERSION = 1.2.2

# the base dir name may be changed depending on git clone command
SRC_DIR = $(shell basename $(shell pwd))
Expand All @@ -19,7 +19,8 @@ DATA_built = $(RELEASE_SQL) \
pg_sphere--1.1.5beta0gavo--1.1.5beta2gavo.sql \
pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql \
pg_sphere--1.1.5beta4gavo--1.2.0.sql \
pg_sphere--1.2.0--1.2.1.sql
pg_sphere--1.2.0--1.2.1.sql \
pg_sphere--1.2.1--1.2.2.sql

DOCS = README.pg_sphere COPYRIGHT.pg_sphere
REGRESS = init tables points euler circle line ellipse poly path box index \
Expand Down Expand Up @@ -82,7 +83,6 @@ healpix_bare/healpix_bare.o : healpix_bare/healpix_bare.c
# experimental for spoint3
pg_version := $(word 2,$(shell $(PG_CONFIG) --version))
pg_version_9_5_plus = $(if $(filter-out 9.1% 9.2% 9.3% 9.4%,$(pg_version)),y,n)
has_parallel = $(if $(filter-out 9.1% 9.2% 9.3% 9.4% 9.5%,$(pg_version)),y,n)
has_explain_summary = $(if $(filter-out 9.%,$(pg_version)),y,n)
#

Expand Down Expand Up @@ -115,9 +115,6 @@ pg_sphere.test.sql: $(RELEASE_SQL) $(shlib)

$(RELEASE_SQL): $(addsuffix .in, $(RELEASE_SQL) $(PGS_SQL))
cat $^ > $@
ifeq ($(has_parallel), n)
sed -i -e '/PARALLEL/d' $@ # version $(pg_version) does not have support for PARALLEL
endif

# for "create extension from unpacked*":

Expand Down Expand Up @@ -199,15 +196,12 @@ pg_sphere--1.1.5beta2gavo--1.1.5beta4gavo.sql: pgs_moc_compat.sql.in

pg_sphere--1.1.5beta4gavo--1.2.0.sql: pgs_moc_ops.sql.in
cat $^ > $@
ifeq ($(has_parallel), n)
sed -i -e '/PARALLEL/d' $@ # version $(pg_version) does not have support for PARALLEL
endif

pg_sphere--1.2.0--1.2.1.sql: pgs_moc_geo_casts.sql.in pgs_epochprop.sql.in
cat $^ > $@
ifeq ($(has_parallel), n)
sed -i -e '/PARALLEL/d' $@ # version $(pg_version) does not have support for PARALLEL
endif

pg_sphere--1.2.1--1.2.2.sql: upgrade_scripts/pg_sphere--1.2.1--1.2.2.sql.in
cat $^ > $@

# end of local stuff

Expand Down
2 changes: 1 addition & 1 deletion expected/init.out
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ CREATE EXTENSION pg_sphere;
select pg_sphere_version();
pg_sphere_version
-------------------
1.2.1
1.2.2
(1 row)

4 changes: 2 additions & 2 deletions gnomo.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
CREATE OR REPLACE FUNCTION gnomonic_proj(spoint, spoint)
RETURNS point
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;

COMMENT ON FUNCTION gnomonic_proj(spoint, spoint) IS
'gnomonic projection, the second argument is the tangential point';

CREATE OR REPLACE FUNCTION gnomonic_inv(point, spoint)
RETURNS spoint
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;

COMMENT ON FUNCTION gnomonic_inv(point, spoint) IS
'inverse of gnomonic projection, the second argument is the tangential point';
28 changes: 14 additions & 14 deletions healpix.sql.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,97 +3,97 @@
CREATE OR REPLACE FUNCTION nest2ring(integer, bigint)
RETURNS bigint
AS 'MODULE_PATHNAME', 'pg_nest2ring'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION nest2ring(integer, bigint) IS
'converts nested Healpix index to a ring Healpix index for the specified integer level (first argument)';

CREATE OR REPLACE FUNCTION ring2nest(integer, bigint)
RETURNS bigint
AS 'MODULE_PATHNAME', 'pg_ring2nest'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION ring2nest(integer, bigint) IS
'converts ringe Healpix index to a nested Healpix index for the specified integer level (first argument)';

CREATE OR REPLACE FUNCTION healpix_convert_nest(integer, integer, bigint)
RETURNS bigint
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION healpix_convert_nest(integer, integer, bigint) IS
'converts nested Healpix index (last argument) from level of second argument to level of first argument';

CREATE OR REPLACE FUNCTION healpix_convert_ring(integer, integer, bigint)
RETURNS bigint
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION healpix_convert_ring(integer, integer, bigint) IS
'converts ring Healpix index (last argument) from level of second argument to level of first argument';

CREATE OR REPLACE FUNCTION nside2order(bigint)
RETURNS integer
AS 'MODULE_PATHNAME', 'pg_nside2order'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION nside2order(bigint) IS
'returns integer part of base-two logarithm of argument for powers of two up to 29';

CREATE OR REPLACE FUNCTION order2nside(integer)
RETURNS bigint
AS 'MODULE_PATHNAME', 'pg_order2nside'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION order2nside(integer) IS
'returns power of two for non-negative values up to 29';

CREATE OR REPLACE FUNCTION nside2npix(bigint)
RETURNS bigint
AS 'MODULE_PATHNAME', 'pg_nside2npix'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION nside2npix(bigint) IS
'returns 12 * nside ^ 2, the number of Healpix elements for the nside parameter';

CREATE OR REPLACE FUNCTION npix2nside(bigint)
RETURNS bigint
AS 'MODULE_PATHNAME', 'pg_npix2nside'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION npix2nside(bigint) IS
'returns the nside parameter correspondig to the number of Healpix elements';

CREATE OR REPLACE FUNCTION healpix_nest(integer, spoint)
RETURNS bigint
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION healpix_nest(integer, spoint) IS
'nested Healpix index of a spherical point for the specified integer level (first argument)';

CREATE OR REPLACE FUNCTION healpix_ring(integer, spoint)
RETURNS bigint
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION healpix_ring(integer, spoint) IS
'Healpix ring index of a spherical point for the specified integer level (first argument)';

CREATE OR REPLACE FUNCTION centre_of_healpix_nest(integer, bigint)
RETURNS spoint
AS 'MODULE_PATHNAME', 'inv_healpix_nest'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION centre_of_healpix_nest(integer, bigint) IS
'spherical point designating the centre of a nested Healpix element for the specified integer level (first argument)';

CREATE OR REPLACE FUNCTION centre_of_healpix_ring(integer, bigint)
RETURNS spoint
AS 'MODULE_PATHNAME', 'inv_healpix_ring'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION centre_of_healpix_ring(integer, bigint) IS
'spherical point designating the centre of a ring Healpix element for the specified integer level (first argument)';

CREATE OR REPLACE FUNCTION center_of_healpix_nest(integer, bigint)
RETURNS spoint
AS 'MODULE_PATHNAME', 'inv_healpix_nest'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION center_of_healpix_nest(integer, bigint) IS
'spherical point designating the center of a nested Healpix element for the specified integer level (first argument)';

CREATE OR REPLACE FUNCTION center_of_healpix_ring(integer, bigint)
RETURNS spoint
AS 'MODULE_PATHNAME', 'inv_healpix_ring'
LANGUAGE C IMMUTABLE STRICT;
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION center_of_healpix_ring(integer, bigint) IS
'spherical point designating the center of a ring Healpix element for the specified integer level (first argument)';
2 changes: 2 additions & 0 deletions pg_sphere--1.2.2.sql.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- complain if this script is run via psql
\echo Use "CREATE EXTENSION pg_sphere" to load this file. \quit
2 changes: 1 addition & 1 deletion pg_sphere.control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pg_sphere extension
comment = 'spherical objects with useful functions, operators and index support'
default_version = '1.2.1'
default_version = '1.2.2'
module_pathname = '$libdir/pg_sphere'
relocatable = true
Loading