1

I recently ran into this error message while executing a query that called one of my PL/pgSQL functions:

ERROR:  cannot assign XIDs during a parallel operation
CONTEXT:  SQL statement [redacted]
PL/pgSQL function [redacted]

The function is marked PARALLEL SAFE, and I assume this error is telling me that it should actually be marked PARALLEL RESTRICTED or PARALLEL UNSAFE. Given that I don't understand what in the code is parallel unsafe, does the above error give me any hint about what I'm doing wrong and what level of safety it requires?

Ben Millwood
  • 6,754
  • 24
  • 45
  • this error message in the postgresql source: https://github.com/postgres/postgres/blob/272d82ec6febb97ab25fd7c67e9c84f4660b16ac/src/backend/access/transam/xact.c#L569 – Ben Millwood Jan 03 '23 at 19:08
  • We don't know either, since we can't see your function. Without more info, all I can do is refer you to the docs: https://www.postgresql.org/docs/current/parallel-safety.html – jjanes Jan 03 '23 at 20:39
  • @jjanes are you explicitly claiming that this error message isn't enough information to know whether the function is parallel-restricted or parallel-unsafe, or just that you'd prefer to read the function's code to figure it out? I agree knowing the function's code would make it easier to figure out this one question, but it wouldn't help the next person who sees this error message in some other context. – Ben Millwood Jan 04 '23 at 10:22

0 Answers0