Skip to content

Commit

Permalink
Merge pull request #36 from segasai/parallel_safe
Browse files Browse the repository at this point in the history
make at least q3c_ang2pix and few other functions parallel safe
  • Loading branch information
segasai authored Dec 13, 2023
2 parents d8a3bf0 + 5534cee commit fef5ea0
Show file tree
Hide file tree
Showing 4 changed files with 1,112 additions and 5 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ jobs:
name: PG source setup
run: |
export CC=${{ matrix.compiler }}
wget https://ftp.postgresql.org/pub/source/v11.8/postgresql-11.8.tar.bz2
tar xfj postgresql-11.8.tar.bz2
mv postgresql-11.8 ../
cd ../postgresql-11.8/
wget https://ftp.postgresql.org/pub/source/v14.10/postgresql-14.10.tar.bz2
tar xfj postgresql-14.10.tar.bz2
mv postgresql-14.10 ../
cd ../postgresql-14.10/
if [[ ${{ matrix.COVERAGE }} == 1 ]] ; then ./configure --enable-coverage --prefix=$PWD/../pg_install/ ; else ./configure --prefix=$PWD/../pg_install/ ; fi
make install
../pg_install/bin/initdb -D ../pg_install/data
Expand All @@ -74,6 +74,12 @@ jobs:
run: |
if [[ ${{ matrix.APT }} == 0 ]] ; then export PATH=$PWD/../pg_install/bin/:$PATH ; fi
make test
- name: UpdateExtension
run: |
if [[ ${{ matrix.APT }} == 0 ]] ; then export PATH=$PWD/../pg_install/bin/:$PATH ; fi
createdb exttest
psql -c "create extension q3c version '2.0.0'" exttest
psql -c "alter extension q3c update to '2.0.1'" exttest
- if: ${{ matrix.COVERAGE == '1' }}
name: Coverall
run: |
Expand Down
2 changes: 1 addition & 1 deletion q3c.control
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
comment = 'q3c sky indexing plugin'
default_version = '2.0.0'
default_version = '2.0.1'
module_pathname = '$libdir/q3c'
relocatable = true
55 changes: 55 additions & 0 deletions scripts/q3c--2.0.0--2.0.1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
\echo Use "CREATE EXTENSION q3c" to load this file. \quit

-- make functions parallel safe

CREATE OR REPLACE FUNCTION q3c_ang2ipix(double precision, double precision)
RETURNS bigint
AS 'MODULE_PATHNAME', 'pgq3c_ang2ipix'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;

CREATE OR REPLACE FUNCTION q3c_ang2ipix(ra real, decl real)
RETURNS bigint
AS 'MODULE_PATHNAME', 'pgq3c_ang2ipix_real'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;

CREATE OR REPLACE FUNCTION q3c_ipix2ang(ipix bigint)
RETURNS double precision[]
AS 'MODULE_PATHNAME', 'pgq3c_ipix2ang'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;

CREATE OR REPLACE FUNCTION q3c_pixarea(ipix bigint, depth int)
RETURNS double precision
AS 'MODULE_PATHNAME', 'pgq3c_pixarea'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;

CREATE OR REPLACE FUNCTION q3c_dist(ra1 double precision, dec1 double precision,
ra2 double precision, dec2 double precision)
RETURNS double precision
AS 'MODULE_PATHNAME', 'pgq3c_dist'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;

CREATE OR REPLACE FUNCTION q3c_sindist(double precision, double precision,
double precision, double precision)
RETURNS double precision
AS 'MODULE_PATHNAME', 'pgq3c_sindist'
LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE COST 100;

CREATE OR REPLACE FUNCTION q3c_sindist_pm(
ra1 double precision, dec1 double precision,
pmra1 double precision, pmdec1 double precision,
cosdec_flag integer,
epoch1 double precision, ra2 double precision, dec2 double precision,
epoch2 double precision)
RETURNS double precision
AS 'MODULE_PATHNAME', 'pgq3c_sindist_pm'
LANGUAGE C IMMUTABLE PARALLEL SAFE COST 100;

CREATE OR REPLACE FUNCTION q3c_dist_pm(
ra1 double precision, dec1 double precision,
pmra1 double precision, pmdec1 double precision,
cosdec_flag int,
epoch1 double precision, ra2 double precision, dec2 double precision,
epoch2 double precision)
RETURNS double precision
AS 'MODULE_PATHNAME', 'pgq3c_dist_pm'
LANGUAGE C IMMUTABLE PARALLEL SAFE COST 100;
Loading

0 comments on commit fef5ea0

Please sign in to comment.