pgsql: Avoid retrieval of CHECK constraints and DEFAULT exprs in data-o

2020-09-16 Thread Michael Paquier
Avoid retrieval of CHECK constraints and DEFAULT exprs in data-only dump Those extra queries are not necessary when doing a data-only dump. With this change, this means that the dependencies between CHECK/DEFAULT and the parent table are not tracked anymore for a data-only dump. However, these d

pgsql: Add leader_pid field into the example of file_fdw for csvlog.

2020-09-16 Thread Fujii Masao
Add leader_pid field into the example of file_fdw for csvlog. Commit b8fdee7d0c added leader_pid field into csvlog, but forgot to update the example of file_fdw for csvlog. Author: Yuta Katsuragi Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e568ed0eb07239b7e53d9

pgsql: Fix bogus cache-invalidation logic in logical replication worker

2020-09-16 Thread Tom Lane
Fix bogus cache-invalidation logic in logical replication worker. The code recorded cache invalidation events by zeroing the "localreloid" field of affected cache entries. However, it's possible for an inval event to occur even while we have the entry open and locked. So an ill-timed inval could

pgsql: Fix bogus cache-invalidation logic in logical replication worker

2020-09-16 Thread Tom Lane
Fix bogus cache-invalidation logic in logical replication worker. The code recorded cache invalidation events by zeroing the "localreloid" field of affected cache entries. However, it's possible for an inval event to occur even while we have the entry open and locked. So an ill-timed inval could

pgsql: Fix bogus cache-invalidation logic in logical replication worker

2020-09-16 Thread Tom Lane
Fix bogus cache-invalidation logic in logical replication worker. The code recorded cache invalidation events by zeroing the "localreloid" field of affected cache entries. However, it's possible for an inval event to occur even while we have the entry open and locked. So an ill-timed inval could

pgsql: Fix bogus cache-invalidation logic in logical replication worker

2020-09-16 Thread Tom Lane
Fix bogus cache-invalidation logic in logical replication worker. The code recorded cache invalidation events by zeroing the "localreloid" field of affected cache entries. However, it's possible for an inval event to occur even while we have the entry open and locked. So an ill-timed inval could

pgsql: Fix bogus cache-invalidation logic in logical replication worker

2020-09-16 Thread Tom Lane
Fix bogus cache-invalidation logic in logical replication worker. The code recorded cache invalidation events by zeroing the "localreloid" field of affected cache entries. However, it's possible for an inval event to occur even while we have the entry open and locked. So an ill-timed inval could

pgsql: Avoid unnecessary recursion to child tables in ALTER TABLE SET N

2020-09-16 Thread Tom Lane
Avoid unnecessary recursion to child tables in ALTER TABLE SET NOT NULL. If a partitioned table's column is already marked NOT NULL, there is no need to examine its partitions, because we can rely on previous DDL to have enforced that the child columns are NOT NULL as well. (Unfortunately, the sam

pgsql: Avoid unnecessary recursion to child tables in ALTER TABLE SET N

2020-09-16 Thread Tom Lane
Avoid unnecessary recursion to child tables in ALTER TABLE SET NOT NULL. If a partitioned table's column is already marked NOT NULL, there is no need to examine its partitions, because we can rely on previous DDL to have enforced that the child columns are NOT NULL as well. (Unfortunately, the sam

pgsql: Avoid unnecessary recursion to child tables in ALTER TABLE SET N

2020-09-16 Thread Tom Lane
Avoid unnecessary recursion to child tables in ALTER TABLE SET NOT NULL. If a partitioned table's column is already marked NOT NULL, there is no need to examine its partitions, because we can rely on previous DDL to have enforced that the child columns are NOT NULL as well. (Unfortunately, the sam

pgsql: Fix amcheck child check pg_upgrade bug.

2020-09-16 Thread Peter Geoghegan
Fix amcheck child check pg_upgrade bug. Commit d114cc53 overlooked the fact that pg_upgrade'd B-Tree indexes have leaf page high keys whose offset numbers do not match the one from the copy of the tuple one level up (the copy stored with a downlink for leaf page's right sibling page). This led to

pgsql: Fix amcheck child check pg_upgrade bug.

2020-09-16 Thread Peter Geoghegan
Fix amcheck child check pg_upgrade bug. Commit d114cc53 overlooked the fact that pg_upgrade'd B-Tree indexes have leaf page high keys whose offset numbers do not match the one from the copy of the tuple one level up (the copy stored with a downlink for leaf page's right sibling page). This led to

pgsql: Don't fetch partition check expression during InitResultRelInfo.

2020-09-16 Thread Tom Lane
Don't fetch partition check expression during InitResultRelInfo. Since there is only one place that actually needs the partition check expression, namely ExecPartitionCheck, it's better to fetch it from the relcache there. In this way we will never fetch it at all if the query never has use for i

pgsql: Centralize setup of SIGQUIT handling for postmaster child proces

2020-09-16 Thread Tom Lane
Centralize setup of SIGQUIT handling for postmaster child processes. We decided that the policy established in commit 7634bd4f6 for the bgwriter, checkpointer, walwriter, and walreceiver processes, namely that they should accept SIGQUIT at all times, really ought to apply uniformly to all postmast

pgsql: Fix bogus completion tag usage in walsender

2020-09-16 Thread Alvaro Herrera
Fix bogus completion tag usage in walsender Since commit fd5942c18f97 (2012, 9.3-era), walsender has been sending completion tags for certain replication commands twice -- and they're not even consistent. Apparently neither libpq nor JDBC have a problem with it, but it's not kosher. Fix by remov

pgsql: Fix bogus completion tag usage in walsender

2020-09-16 Thread Alvaro Herrera
Fix bogus completion tag usage in walsender Since commit fd5942c18f97 (2012, 9.3-era), walsender has been sending completion tags for certain replication commands twice -- and they're not even consistent. Apparently neither libpq nor JDBC have a problem with it, but it's not kosher. Fix by remov

pgsql: Improve formatting of create_help.pl and plperl_opmask.pl output

2020-09-16 Thread Tom Lane
Improve formatting of create_help.pl and plperl_opmask.pl output. Adjust the whitespace in the emitted files so that it matches what pgindent would do. This makes the generated files look like they match project style, and avoids confusion if someone does run pgindent on the generated files. Als

pgsql: Teach walsender to update its process title for replication comm

2020-09-16 Thread Tom Lane
Teach walsender to update its process title for replication commands. Because the code path taken for SQL commands executed in a walsender will update the process title, we pretty much have to update the title for replication commands as well. Otherwise, the title shows "idle" for the rest of a l

pgsql: Improve tab completion of IMPORT FOREIGN SCHEMA in psql

2020-09-16 Thread Michael Paquier
Improve tab completion of IMPORT FOREIGN SCHEMA in psql It is not possible to get a list of foreign schemas as the server is not known, so this provides instead a list of local schemas, which is more useful than nothing if using a loopback server or having schema names matching in the local and re