pgsql: Clean up handling of client_encoding GUC in parallel workers.
От | Tom Lane |
---|---|
Тема | pgsql: Clean up handling of client_encoding GUC in parallel workers. |
Дата | |
Msg-id | E1sbMwj-002zGD-2I@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Clean up handling of client_encoding GUC in parallel workers. The previous coding here threw an error from assign_client_encoding if it was invoked in a parallel worker. That's a very fundamental violation of the GUC hook API: assign hooks must not throw errors. The place to complain is in the check hook, so move the test to there, and use the regular check-hook API (ie return false) to report it. The reason this coding is a problem is that it breaks GUC rollback, which may occur after we leave InitializingParallelWorker state. That case seems not actually reachable before now, but commit f5f30c22e made it reachable, so we need to fix this before that can be un-reverted. In passing, improve the commentary in ParallelWorkerMain, and add a check for failure of SetClientEncoding. That's another case that can't happen now but might become possible after foreseeable code rearrangements (notably, if the shortcut of skipping PrepareClientEncoding stops being OK). Discussion: https://postgr.es/m/18545-feba138862f19aaa@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/0ae5b763ea0e9dcd85521ebdc9285bbdc7470331 Modified Files -------------- src/backend/access/transam/parallel.c | 8 ++++-- src/backend/commands/variable.c | 47 +++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 23 deletions(-)
В списке pgsql-committers по дате отправления: