diff --git a/expected/epochprop.out b/expected/epochprop.out index f83d488..74e4253 100644 --- a/expected/epochprop.out +++ b/expected/epochprop.out @@ -81,7 +81,7 @@ FROM ( 120) AS tp) AS q; to_char | to_char | to_char | to_char | to_char | to_char -----------------+-----------------+----------+---------+---------+---------- - 269.4520769500 | 5.0388680565 | 23.007 | | | -97.120 + 269.4520769500 | 4.6933649660 | 23.007 | | | -110.000 (1 row) SELECT epoch_prop(NULL, diff --git a/src/epochprop.c b/src/epochprop.c index bf8d707..37aab5d 100644 --- a/src/epochprop.c +++ b/src/epochprop.c @@ -144,28 +144,21 @@ epoch_prop(PG_FUNCTION_ARGS) { input.parallax = 0; output_null[2] = 1; /* The way we do our computation, with a bad parallax the RV - will be horribly off, too, so null this out, too */ + will be horribly off, too, so null this out, too; if avaialble, + we will fiddle in the original RV below again. */ output_null[5] = 1; } else { input.parallax = PG_GETARG_FLOAT8(1); } input.parallax_valid = fabs(input.parallax) > PX_MIN; - if (PG_ARGISNULL(2)) { + if (PG_ARGISNULL(2) || PG_ARGISNULL(3)) { input.pm[0] = 0; input.pm[1] = 0; output_null[3] = 1; output_null[4] = 1; } else { input.pm[0] = PG_GETARG_FLOAT8(2); - } - - if (PG_ARGISNULL(3)) { - input.pm[0] = 0; - input.pm[1] = 0; - output_null[3] = 1; - output_null[4] = 1; - } else { input.pm[1] = PG_GETARG_FLOAT8(3); } diff --git a/src/epochprop.h b/src/epochprop.h index a93e4c3..3b61a02 100644 --- a/src/epochprop.h +++ b/src/epochprop.h @@ -6,15 +6,6 @@ extern Datum epoch_prop(PG_FUNCTION_ARGS); -/* a cartesian point; this is like geo_decl's point, but you can't -have both geo_decls and pg_sphere right now (both define a type Point, -not to mention they have different ideas on EPSILON */ -typedef struct s_cpoint -{ - double x, - y; -} CPoint; - typedef struct s_phasevec { SPoint pos; /* Position as an SPoint */ @@ -22,5 +13,5 @@ typedef struct s_phasevec * longitude has cos(lat) applied */ double parallax; /* in rad */ double rv; /* radial velocity in km/s */ - int parallax_valid; /* 1 if the parallax really is a NULL */ + int parallax_valid; /* 1 if we accept the parallax as physical */ } phasevec;