pgsql: Handle EACCES errors from kevent() better.

2020-10-14 Thread Thomas Munro
Handle EACCES errors from kevent() better. While registering for postmaster exit events, we have to handle a couple of edge cases where the postmaster is already gone. Commit 815c2f09 missed one: EACCES must surely imply that PostmasterPid no longer belongs to our postmaster process (or alternati

pgsql: Handle EACCES errors from kevent() better.

2020-10-14 Thread Thomas Munro
Handle EACCES errors from kevent() better. While registering for postmaster exit events, we have to handle a couple of edge cases where the postmaster is already gone. Commit 815c2f09 missed one: EACCES must surely imply that PostmasterPid no longer belongs to our postmaster process (or alternati

pgsql: Execute invalidation messages for each XLOG_XACT_INVALIDATIONS m

2020-10-14 Thread Amit Kapila
Execute invalidation messages for each XLOG_XACT_INVALIDATIONS message during logical decoding. Prior to commit c55040ccd0 we have no way of knowing the invalidations before commit. So, while decoding we use to execute all the invalidations at each command end as we had no way of knowing which inv

pgsql: doc: Mention that toast_tuple_target affects also column marked

2020-10-14 Thread Fujii Masao
doc: Mention that toast_tuple_target affects also column marked as Main. Previously it was documented that toast_tuple_target affected column marked as only External or Extended. But this description is not correct and toast_tuple_target affects also column marked as Main. Back-patch to v11 where

pgsql: doc: Mention that toast_tuple_target affects also column marked

2020-10-14 Thread Fujii Masao
doc: Mention that toast_tuple_target affects also column marked as Main. Previously it was documented that toast_tuple_target affected column marked as only External or Extended. But this description is not correct and toast_tuple_target affects also column marked as Main. Back-patch to v11 where

pgsql: doc: Mention that toast_tuple_target affects also column marked

2020-10-14 Thread Fujii Masao
doc: Mention that toast_tuple_target affects also column marked as Main. Previously it was documented that toast_tuple_target affected column marked as only External or Extended. But this description is not correct and toast_tuple_target affects also column marked as Main. Back-patch to v11 where

pgsql: doc: Mention that toast_tuple_target affects also column marked

2020-10-14 Thread Fujii Masao
doc: Mention that toast_tuple_target affects also column marked as Main. Previously it was documented that toast_tuple_target affected column marked as only External or Extended. But this description is not correct and toast_tuple_target affects also column marked as Main. Back-patch to v11 where

pgsql: Restore replication protocol's duplicate command tags

2020-10-14 Thread Alvaro Herrera
Restore replication protocol's duplicate command tags I removed the duplicate command tags for START_REPLICATION inadvertently in commit 07082b08cc5d, but the replication protocol requires them. The fact that the replication protocol was broken was not noticed because all our test cases use an op

pgsql: Restore replication protocol's duplicate command tags

2020-10-14 Thread Alvaro Herrera
Restore replication protocol's duplicate command tags I removed the duplicate command tags for START_REPLICATION inadvertently in commit 07082b08cc5d, but the replication protocol requires them. The fact that the replication protocol was broken was not noticed because all our test cases use an op

pgsql: Make WL_POSTMASTER_DEATH level-triggered on kqueue builds.

2020-10-14 Thread Thomas Munro
Make WL_POSTMASTER_DEATH level-triggered on kqueue builds. If WaitEventSetWait() reports that the postmaster has gone away, later calls to WaitEventSetWait() should continue to report that. Otherwise further waits that occur in the proc_exit() path after we already noticed the postmaster's demise

pgsql: Make WL_POSTMASTER_DEATH level-triggered on kqueue builds.

2020-10-14 Thread Thomas Munro
Make WL_POSTMASTER_DEATH level-triggered on kqueue builds. If WaitEventSetWait() reports that the postmaster has gone away, later calls to WaitEventSetWait() should continue to report that. Otherwise further waits that occur in the proc_exit() path after we already noticed the postmaster's demise

pgsql: Remove es_result_relation_info from EState.

2020-10-14 Thread Heikki Linnakangas
Remove es_result_relation_info from EState. Maintaining 'es_result_relation_info' correctly at all times has become cumbersome, especially with partitioning where each partition gets its own result relation info. Having to set and reset it across arbitrary operations has caused bugs in the past.

pgsql: Include result relation info in direct modify ForeignScan nodes.

2020-10-14 Thread Heikki Linnakangas
Include result relation info in direct modify ForeignScan nodes. FDWs that can perform an UPDATE/DELETE remotely using the "direct modify" set of APIs need to access the ResultRelInfo of the target table. That's currently available in EState.es_result_relation_info, but the next commit will remove