According to the documentation:
"Functions and aggregates must be marked PARALLEL UNSAFE if they write to
the database, access sequences, change the transaction state even
temporarily (e.g. a PL/pgSQL function which establishes an EXCEPTION block
to catch errors), or make persistent changes to settings."
If a LANGUAGE C function calls ereport(ERROR, ...), does that qualify as a
potential change to the transaction state that requires it to be marked
PARALLEL UNSAFE? If an error is raised in one parallel worker, does this
cause the other parallel workers to be immediately terminated?
How about a C function f(x) that calls out to an external system and returns
a text value. If f(x) is altered on the external system, it might return a
slightly different answer for some x. Let's say that for some x it returns
"one" instead of "1", and we happen to know that users don't care if it
returns "one" or "1". If someone were to declare f(x) to be PARALLEL SAFE,
what's the worst that could happen?
-----
Jim Finnerty, AWS, Amazon Aurora PostgreSQL
--
Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html