pgsql: Do not rely on pgstat.h to indirectly include storage/ headers.

2021-04-02 Thread Andres Freund
Do not rely on pgstat.h to indirectly include storage/ headers. An upcoming patch might remove the (now indirect) proc.h include (which in turn includes other headers), and it's cleaner for the modified files to include their dependencies directly anyway... Discussion: https://postgr.es/m/202104

pgsql: Split wait event related code from pgstat.[ch] into wait_event.[

2021-04-02 Thread Andres Freund
Split wait event related code from pgstat.[ch] into wait_event.[ch]. The wait event related code is independent from the rest of the pgstat.[ch] code, of nontrivial size and changes on a regular basis. Put it into its own set of files. As there doesn't seem to be a good pre-existing directory for

Re: pgsql: Add 'noError' argument to encoding conversion functions.

2021-04-02 Thread Michael Paquier
On Fri, Apr 02, 2021 at 06:53:37PM -0500, Jaime Casanova wrote: > sqlsmith thinks that test_enc_conversion() must be marked as STRICT. It > crashes with something like this: This one has won an open item. -- Michael signature.asc Description: PGP signature

Re: pgsql: Add 'noError' argument to encoding conversion functions.

2021-04-02 Thread Jaime Casanova
On Thu, Apr 01, 2021 at 09:25:00AM +, Heikki Linnakangas wrote: > > Add regression tests for built-in encoding conversions. This doesn't cover > every conversion, but it covers all the internal functions in conv.c that > are used to implement the conversions. > sqlsmith thinks that test_enc_

Re: pgsql: Add Result Cache executor node (take 2)

2021-04-02 Thread David Rowley
On Sat, 3 Apr 2021 at 09:47, Andres Freund wrote: > Since this commit I am seeing > > In file included from /home/andres/src/postgresql/src/include/postgres.h:46, > from > /home/andres/src/postgresql/src/backend/executor/nodeResultCache.c:67: > /home/andres/src/postgresql/src/bac

pgsql: Remove useless Asserts in Result Cache code

2021-04-02 Thread David Rowley
Remove useless Asserts in Result Cache code Testing if an unsigned variable is >= 0 is pretty pointless. There's likely enough code in remove_cache_entry() to verify the cache memory accounting is correct in assert enabled builds. These Asserts were not adding much extra cover, even if they had b

Re: pgsql: Add Result Cache executor node (take 2)

2021-04-02 Thread Andres Freund
Hi, On 2021-04-02 01:11:35 +, David Rowley wrote: > Add Result Cache executor node (take 2) Since this commit I am seeing In file included from /home/andres/src/postgresql/src/include/postgres.h:46, from /home/andres/src/postgresql/src/backend/executor/nodeResultCache.c:67:

pgsql: Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib

2021-04-02 Thread Bruce Momjian
Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib All other places already use MONTHS_PER_YEAR appropriately. Backpatch-through: 9.6 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/84bc2b17523ef485f102be7f00f7affb88f00f18 Modified Files --

pgsql: Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib

2021-04-02 Thread Bruce Momjian
Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib All other places already use MONTHS_PER_YEAR appropriately. Backpatch-through: 9.6 Branch -- REL_10_STABLE Details --- https://git.postgresql.org/pg/commitdiff/b4c3a9f32058694e63f053043e11caaae577c9a9 Modified Files

pgsql: Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib

2021-04-02 Thread Bruce Momjian
Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib All other places already use MONTHS_PER_YEAR appropriately. Backpatch-through: 9.6 Branch -- REL9_6_STABLE Details --- https://git.postgresql.org/pg/commitdiff/605ef23c7c0fb44f841ec8f1f588325dd8fc951e Modified Files

pgsql: Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib

2021-04-02 Thread Bruce Momjian
Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib All other places already use MONTHS_PER_YEAR appropriately. Backpatch-through: 9.6 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/45aea47ef430bc942b831932adaca7730c6ae775 Modified Files

pgsql: Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib

2021-04-02 Thread Bruce Momjian
Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib All other places already use MONTHS_PER_YEAR appropriately. Backpatch-through: 9.6 Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/438d7f36ffcc91c81d4e6a4716e556d5bf4f9a78 Modified Files

pgsql: Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib

2021-04-02 Thread Bruce Momjian
Use macro MONTHS_PER_YEAR instead of '12' in /ecpg/pgtypeslib All other places already use MONTHS_PER_YEAR appropriately. Backpatch-through: 9.6 Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/6972d9104b6c54bae2fd63d8e02e9c014d162ca3 Modified Files

pgsql: Detect POLLHUP/POLLRDHUP while running queries.

2021-04-02 Thread Thomas Munro
Detect POLLHUP/POLLRDHUP while running queries. Provide a new GUC check_client_connection_interval that can be used to check whether the client connection has gone away, while running very long queries. It is disabled by default. For now this uses a non-standard Linux extension (also adopted by

pgsql: Clarify documentation of RESET ROLE

2021-04-02 Thread Joe Conway
Clarify documentation of RESET ROLE Command-line options, or previous "ALTER (ROLE|DATABASE) ... SET ROLE ..." commands, can change the value of the default role for a session. In the presence of one of these, RESET ROLE will change the current user identifier to the default role rather than the s

pgsql: Clarify documentation of RESET ROLE

2021-04-02 Thread Joe Conway
Clarify documentation of RESET ROLE Command-line options, or previous "ALTER (ROLE|DATABASE) ... SET ROLE ..." commands, can change the value of the default role for a session. In the presence of one of these, RESET ROLE will change the current user identifier to the default role rather than the s

pgsql: Clarify documentation of RESET ROLE

2021-04-02 Thread Joe Conway
Clarify documentation of RESET ROLE Command-line options, or previous "ALTER (ROLE|DATABASE) ... SET ROLE ..." commands, can change the value of the default role for a session. In the presence of one of these, RESET ROLE will change the current user identifier to the default role rather than the s

pgsql: Clarify documentation of RESET ROLE

2021-04-02 Thread Joe Conway
Clarify documentation of RESET ROLE Command-line options, or previous "ALTER (ROLE|DATABASE) ... SET ROLE ..." commands, can change the value of the default role for a session. In the presence of one of these, RESET ROLE will change the current user identifier to the default role rather than the s

pgsql: Clarify documentation of RESET ROLE

2021-04-02 Thread Joe Conway
Clarify documentation of RESET ROLE Command-line options, or previous "ALTER (ROLE|DATABASE) ... SET ROLE ..." commands, can change the value of the default role for a session. In the presence of one of these, RESET ROLE will change the current user identifier to the default role rather than the s

pgsql: Clarify documentation of RESET ROLE

2021-04-02 Thread Joe Conway
Clarify documentation of RESET ROLE Command-line options, or previous "ALTER (ROLE|DATABASE) ... SET ROLE ..." commands, can change the value of the default role for a session. In the presence of one of these, RESET ROLE will change the current user identifier to the default role rather than the s

pgsql: pg_checksums: Fix progress reporting.

2021-04-02 Thread Fujii Masao
pg_checksums: Fix progress reporting. pg_checksums uses two counters, total size and current size, to calculate the progress. Previously the progress that pg_checksums reported could not reach 100% at the end. The cause of this issue was that the sizes of only pages excluding new ones in each file

pgsql: pg_checksums: Fix progress reporting.

2021-04-02 Thread Fujii Masao
pg_checksums: Fix progress reporting. pg_checksums uses two counters, total size and current size, to calculate the progress. Previously the progress that pg_checksums reported could not reach 100% at the end. The cause of this issue was that the sizes of only pages excluding new ones in each file

pgsql: pg_checksums: Fix progress reporting.

2021-04-02 Thread Fujii Masao
pg_checksums: Fix progress reporting. pg_checksums uses two counters, total size and current size, to calculate the progress. Previously the progress that pg_checksums reported could not reach 100% at the end. The cause of this issue was that the sizes of only pages excluding new ones in each file

pgsql: Strip file names reported in error messages on Windows, too.

2021-04-02 Thread Tom Lane
Strip file names reported in error messages on Windows, too. Commit dd136052b established a policy that error message FILE items should include only the base name of the reporting source file, for uniformity and succinctness. We now observe that some Windows compilers use backslashes in __FILE__

pgsql: Fix typo in 6d7a6feac4

2021-04-02 Thread Andrew Dunstan
Fix typo in 6d7a6feac4 Per gripe from Daniel Gustafsson Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/1877c9ac3acc05cc787dd6392d073202f8c8ee21 Modified Files -- src/test/ssl/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: postgres_fdw: Add option to control whether to keep connections

2021-04-02 Thread Fujii Masao
postgres_fdw: Add option to control whether to keep connections open. This commit adds a new option keep_connections that controls whether postgres_fdw keeps the connections to the foreign server open so that the subsequent queries can re-use them. This option can only be specified for a foreign s

pgsql: Add support for NullIfExpr in eval_const_expressions

2021-04-02 Thread Peter Eisentraut
Add support for NullIfExpr in eval_const_expressions Author: Hou Zhijie Discussion: https://www.postgresql.org/message-id/flat/7ea5ce773bbc4eea9ff1a381acd3b102@G08CNEXMBPEKD05.g08.fujitsu.local Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/9c5f67fd6256246b2a788a

pgsql: Fix pgstat_report_replslot() to use proper data types for its ar

2021-04-02 Thread Fujii Masao
Fix pgstat_report_replslot() to use proper data types for its arguments. The caller of pgstat_report_replslot() passes int64 values to the function. Also the function stores those values in PgStat_Counter (i.e., int64) fields of PgStat_MsgReplSlot struct. But previously the function used "int" as

pgsql: doc: Clarify how to generate backup files with non-exclusive bac

2021-04-02 Thread Michael Paquier
doc: Clarify how to generate backup files with non-exclusive backups The current instructions describing how to write the backup_label and tablespace_map files are confusing. For example, opening a file in text mode on Windows and copy-pasting the file's contents would result in a failure at reco

pgsql: doc: Clarify how to generate backup files with non-exclusive bac

2021-04-02 Thread Michael Paquier
doc: Clarify how to generate backup files with non-exclusive backups The current instructions describing how to write the backup_label and tablespace_map files are confusing. For example, opening a file in text mode on Windows and copy-pasting the file's contents would result in a failure at reco

pgsql: doc: Clarify how to generate backup files with non-exclusive bac

2021-04-02 Thread Michael Paquier
doc: Clarify how to generate backup files with non-exclusive backups The current instructions describing how to write the backup_label and tablespace_map files are confusing. For example, opening a file in text mode on Windows and copy-pasting the file's contents would result in a failure at reco

pgsql: doc: Clarify how to generate backup files with non-exclusive bac

2021-04-02 Thread Michael Paquier
doc: Clarify how to generate backup files with non-exclusive backups The current instructions describing how to write the backup_label and tablespace_map files are confusing. For example, opening a file in text mode on Windows and copy-pasting the file's contents would result in a failure at reco

pgsql: doc: Clarify how to generate backup files with non-exclusive bac

2021-04-02 Thread Michael Paquier
doc: Clarify how to generate backup files with non-exclusive backups The current instructions describing how to write the backup_label and tablespace_map files are confusing. For example, opening a file in text mode on Windows and copy-pasting the file's contents would result in a failure at reco

pgsql: doc: Clarify how to generate backup files with non-exclusive bac

2021-04-02 Thread Michael Paquier
doc: Clarify how to generate backup files with non-exclusive backups The current instructions describing how to write the backup_label and tablespace_map files are confusing. For example, opening a file in text mode on Windows and copy-pasting the file's contents would result in a failure at reco

pgsql: Fix typos in comments.

2021-04-02 Thread Fujii Masao
Fix typos in comments. Author: Masahiko Sawada Discussion: https://postgr.es/m/cad21aoa1yl7t0nzvseysx6zoae7xo3r0jyu8hkitgl2_xba...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/98e5bd103f887326e381c509c2fbe879ba3ea2f3 Modified Files --