"Sergey E. Koposov" <[EMAIL PROTECTED]> writes: > C function definition:
> PG_FUNCTION_INFO_V1(pgq3c_ang2ipix); > Datum pgq3c_ang2ipix(PG_FUNCTION_ARGS) > { > static q3c_ipix_t ipix_buf; > ipix_buf ++; > elog(WARNING,"%lld",ipix_buf); > return PointerGetDatum((&ipix_buf)); > } This code is wrong on its face: it can't support multiple calls to the function within a single query, because each call will damage the previous call's result. Try something like select pgq3c_ang2ipix(...), pgq3c_ang2ipix(...) from ... and you'll get bizarre behavior. You need to return a palloc'd result, rather than returning pointers to the same static variable on successive calls. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster