pgsql: Refactor XLogReadRecord(), adding XLogBeginRead() function.

2020-01-26 Thread Heikki Linnakangas
Refactor XLogReadRecord(), adding XLogBeginRead() function. The signature of XLogReadRecord() required the caller to pass the starting WAL position as argument, or InvalidXLogRecPtr to continue reading at the end of previous record. That's slightly awkward to the callers, as most of them don't wan

pgsql: In postgres_fdw, don't try to ship MULTIEXPR updates to remote s

2020-01-26 Thread Tom Lane
In postgres_fdw, don't try to ship MULTIEXPR updates to remote server. In a statement like "UPDATE remote_tab SET (x,y) = (SELECT ...)", we'd conclude that the statement could be directly executed remotely, because the sub-SELECT is in a resjunk tlist item that's not examined for shippability. Cu

pgsql: In postgres_fdw, don't try to ship MULTIEXPR updates to remote s

2020-01-26 Thread Tom Lane
In postgres_fdw, don't try to ship MULTIEXPR updates to remote server. In a statement like "UPDATE remote_tab SET (x,y) = (SELECT ...)", we'd conclude that the statement could be directly executed remotely, because the sub-SELECT is in a resjunk tlist item that's not examined for shippability. Cu

pgsql: In postgres_fdw, don't try to ship MULTIEXPR updates to remote s

2020-01-26 Thread Tom Lane
In postgres_fdw, don't try to ship MULTIEXPR updates to remote server. In a statement like "UPDATE remote_tab SET (x,y) = (SELECT ...)", we'd conclude that the statement could be directly executed remotely, because the sub-SELECT is in a resjunk tlist item that's not examined for shippability. Cu

pgsql: In postgres_fdw, don't try to ship MULTIEXPR updates to remote s

2020-01-26 Thread Tom Lane
In postgres_fdw, don't try to ship MULTIEXPR updates to remote server. In a statement like "UPDATE remote_tab SET (x,y) = (SELECT ...)", we'd conclude that the statement could be directly executed remotely, because the sub-SELECT is in a resjunk tlist item that's not examined for shippability. Cu

pgsql: In postgres_fdw, don't try to ship MULTIEXPR updates to remote s

2020-01-26 Thread Tom Lane
In postgres_fdw, don't try to ship MULTIEXPR updates to remote server. In a statement like "UPDATE remote_tab SET (x,y) = (SELECT ...)", we'd conclude that the statement could be directly executed remotely, because the sub-SELECT is in a resjunk tlist item that's not examined for shippability. Cu

pgsql: Refactor confusing code in _mdfd_openseg().

2020-01-26 Thread Thomas Munro
Refactor confusing code in _mdfd_openseg(). As reported independently by a couple of people, _mdfd_openseg() is coded in a way that seems to imply that the segments could be opened in an order that isn't strictly sequential. Even if that were true, it's also using the wrong comparison. It's not

pgsql: Fix EXPLAIN (SETTINGS) to follow policy about when to print empt

2020-01-26 Thread Tom Lane
Fix EXPLAIN (SETTINGS) to follow policy about when to print empty fields. In non-TEXT output formats, the "Settings" field should appear when requested, even if it would be empty. Also, get rid of the premature optimization of counting all the GUC_EXPLAIN variables at startup. Since there was no

pgsql: Fix EXPLAIN (SETTINGS) to follow policy about when to print empt

2020-01-26 Thread Tom Lane
Fix EXPLAIN (SETTINGS) to follow policy about when to print empty fields. In non-TEXT output formats, the "Settings" field should appear when requested, even if it would be empty. Also, get rid of the premature optimization of counting all the GUC_EXPLAIN variables at startup. Since there was no

pgsql: Fix some memory leaks and improve restricted token handling on W

2020-01-26 Thread Michael Paquier
Fix some memory leaks and improve restricted token handling on Windows The leaks have been detected by a Coverity run on Windows. No backpatch is done as the leaks are minor. While on it, make restricted token creation more consistent in its error handling by logging an error instead of a warnin

pgsql: Avoid unnecessary shm writes in Parallel Hash Join.

2020-01-26 Thread Thomas Munro
Avoid unnecessary shm writes in Parallel Hash Join. Currently, Parallel Hash Join cannot be used for full/right joins, so there is no point in setting the match flag. It turns out that the cache coherence traffic generated by those writes slows down large systems running many-core joins, so let's

pgsql: Avoid unnecessary shm writes in Parallel Hash Join.

2020-01-26 Thread Thomas Munro
Avoid unnecessary shm writes in Parallel Hash Join. Currently, Parallel Hash Join cannot be used for full/right joins, so there is no point in setting the match flag. It turns out that the cache coherence traffic generated by those writes slows down large systems running many-core joins, so let's

pgsql: Avoid unnecessary shm writes in Parallel Hash Join.

2020-01-26 Thread Thomas Munro
Avoid unnecessary shm writes in Parallel Hash Join. Currently, Parallel Hash Join cannot be used for full/right joins, so there is no point in setting the match flag. It turns out that the cache coherence traffic generated by those writes slows down large systems running many-core joins, so let's