title: Postgres C extension parallel aggregate, how to get worker id and row number?
body: <p>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.</p>
  <p>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.</p>
  <ol>
  <li>Is there a way to get worker_id on postgres for parallel C aggregate extensions?</li>
  <li>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?</li>
  </ol>
  <p>At least I know the <a href="https://github.com/postgres/postgres/blob/09dfd430118f1fadf52a782db5ee161b1eb16337/src/backend/access/transam/parallel.c" rel="nofollow noreferrer">worker ID</a> exists, just don't know how to get it.</p>