I am writing a Postgres C extension for a Parallel Aggregate function. Normally, in C or C++ I get my thread id and indexing of the work to be done, and then I can make sure the work can be done with no dependency and that the final result is always correct.
Absent getting an index (the row number on the table, not a postgres index) on the row I am operating on along with the worker id I cannot process anything with my aggregate function and guarantee correctness.
- Is there a way to get worker_id on postgres for parallel C aggregate extensions?
- Is there a way to get the row index/id/number from inside a C aggregate function without having to calculate it in SQL and pass it as a column to my function?
At least I know the worker ID exists, just don't know how to get it.