Whan is it safe to mark a function PARALLEL SAFE?

Поиск
Список
Период
Сортировка
От Jim Finnerty
Тема Whan is it safe to mark a function PARALLEL SAFE?
Дата
Msg-id 1567906652523-0.post@n3.nabble.com
обсуждение исходный текст
Ответы Re: Whan is it safe to mark a function PARALLEL SAFE?
Список pgsql-general
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



В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: How to access Postgres .pgpass file from php?
Следующее
От: Chris Travers
Дата:
Сообщение: Re: kind of a bag of attributes in a DB . . .