summaryrefslogtreecommitdiff
path: root/src/include/commands/async.h
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-06-30 18:35:32 -0400
committerRobert Haas <rhaas@postgresql.org>2016-06-30 18:35:32 -0400
commit10c0558ffefcd12bf1d3dc35587eba41d1ce4571 (patch)
tree5b6344c420e2822f7c66f626294218adbd54343f /src/include/commands/async.h
parentf8c58554db48fe004938a8a34a42afb78157b66c (diff)
downloadpostgresql-10c0558ffefcd12bf1d3dc35587eba41d1ce4571.tar.gz
Fix several mistakes around parallel workers and client_encoding.
Previously, workers sent data to the leader using the client encoding. That mostly worked, but the leader the converted the data back to the server encoding. Since not all encoding conversions are reversible, that could provoke failures. Fix by using the database encoding for all communication between worker and leader. Also, while temporary changes to GUC settings, as from the SET clause of a function, are in general OK for parallel query, changing client_encoding this way inside of a parallel worker is not OK. Previously, that would have confused the leader; with these changes, it would not confuse the leader, but it wouldn't do anything either. So refuse such changes in parallel workers. Also, the previous code naively assumed that when it received a NotifyResonse from the worker, it could pass that directly back to the user. But now that worker-to-leader communication always uses the database encoding, that's clearly no longer correct - though, actually, the old way was always broken for V2 clients. So disassemble and reconstitute the message instead. Issues reported by Peter Eisentraut. Patch by me, reviewed by Peter Eisentraut.
Diffstat (limited to 'src/include/commands/async.h')
-rw-r--r--src/include/commands/async.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/include/commands/async.h b/src/include/commands/async.h
index b4c13fac4a..95559df19f 100644
--- a/src/include/commands/async.h
+++ b/src/include/commands/async.h
@@ -28,6 +28,10 @@ extern volatile sig_atomic_t notifyInterruptPending;
extern Size AsyncShmemSize(void);
extern void AsyncShmemInit(void);
+extern void NotifyMyFrontEnd(const char *channel,
+ const char *payload,
+ int32 srcPid);
+
/* notify-related SQL statements */
extern void Async_Notify(const char *channel, const char *payload);
extern void Async_Listen(const char *channel);