@@ -25,7 +25,7 @@ PG_FUNCTION_INFO_V1(epoch_prop);
2525/* A_nu as per ESA/SP-1200 */
2626#define A_NU (AU/(J_YEAR))
2727
28- /* Following SOFA, we use 1e-7 arcsec as minimal parallax
28+ /* Following SOFA, we use 1e-7 arcsec as minimal parallax
2929 ("celestial sphere"); parallax=0 exactly means "infinite distance", which
3030 leads to all sorts for problems; our parallaxes come in in mas, so: */
3131#define PX_MIN 1e-7*1000
@@ -59,11 +59,11 @@ static void propagate_phasevec(
5959 spoint_vector3d (& r0 , & (pv -> pos ));
6060
6161 p0 .x = - sin (pv -> pos .lng );
62- p0 .y = cos (pv -> pos .lng );
62+ p0 .y = cos (pv -> pos .lng );
6363 p0 .z = 0 ;
6464
6565 q0 .x = - sin (pv -> pos .lat ) * cos (pv -> pos .lng );
66- q0 .y = - sin (pv -> pos .lat ) * sin (pv -> pos .lng );
66+ q0 .y = - sin (pv -> pos .lat ) * sin (pv -> pos .lng );
6767 q0 .z = cos (pv -> pos .lat );
6868
6969 /* the original proper motion vector */
@@ -117,25 +117,25 @@ static void propagate_phasevec(
117117}
118118
119119
120- /*
120+ /*
121121 Propagate a position with proper motions and optionally parallax
122122 and radial velocity.
123123
124124 Arguments: pos0 (spoint), pm_long, pm_lat (in rad/yr)
125- par (parallax, mas), rv (in km/s), delta_t (in years)
125+ par (parallax, mas), rv (in km/s), delta_t (in years)
126126
127127 This returns a 6-array of lat, long (in rad), parallax (in mas)
128128 pmlat, pmlong (in rad/yr), rv (in km/s).
129129*/
130- Datum
130+ Datum
131131epoch_prop (PG_FUNCTION_ARGS ) {
132132 double delta_t ;
133133 phasevec input , output ;
134134 ArrayType * result ;
135135 Datum retvals [6 ];
136136
137137 if (PG_ARGISNULL (0 )) {
138- ereport (ERROR ,
138+ ereport (ERROR ,
139139 (errcode (ERRCODE_NULL_VALUE_NOT_ALLOWED ),
140140 errmsg ("NULL position not supported in epoch propagation" ))); }
141141 memcpy (& (input .pos ), (void * )PG_GETARG_POINTER (0 ), sizeof (SPoint ));
@@ -164,6 +164,10 @@ epoch_prop(PG_FUNCTION_ARGS) {
164164 input .rv = PG_GETARG_FLOAT8 (4 );
165165 }
166166
167+ if (PG_ARGISNULL (5 )) {
168+ ereport (ERROR ,
169+ (errcode (ERRCODE_NULL_VALUE_NOT_ALLOWED ),
170+ errmsg ("NULL delta t not supported in epoch propagation" ))); }
167171 delta_t = PG_GETARG_FLOAT8 (5 );
168172
169173 propagate_phasevec (& input , delta_t , & output );
0 commit comments