pgsql: Avoid direct C access to possibly-null pg_subscription_rel.srsub

2020-07-21 Thread Tom Lane
Avoid direct C access to possibly-null pg_subscription_rel.srsublsn. This coding technique is unsafe, since we'd be accessing off the end of the tuple if the field is null. SIGSEGV is pretty improbable, but perhaps not impossible. Also, returning garbage for the LSN doesn't seem like a great ide

pgsql: Avoid direct C access to possibly-null pg_subscription_rel.srsub

2020-07-21 Thread Tom Lane
Avoid direct C access to possibly-null pg_subscription_rel.srsublsn. This coding technique is unsafe, since we'd be accessing off the end of the tuple if the field is null. SIGSEGV is pretty improbable, but perhaps not impossible. Also, returning garbage for the LSN doesn't seem like a great ide

pgsql: Avoid direct C access to possibly-null pg_subscription_rel.srsub

2020-07-21 Thread Tom Lane
Avoid direct C access to possibly-null pg_subscription_rel.srsublsn. This coding technique is unsafe, since we'd be accessing off the end of the tuple if the field is null. SIGSEGV is pretty improbable, but perhaps not impossible. Also, returning garbage for the LSN doesn't seem like a great ide

pgsql: Assert that we don't insert nulls into attnotnull catalog column

2020-07-21 Thread Tom Lane
Assert that we don't insert nulls into attnotnull catalog columns. The executor checks for this error, and so does the bootstrap catalog loader, but we never checked for it in retail catalog manipulations. The folly of that has now been exposed, so let's add assertions checking it. Checking in Ca

pgsql: Assert that we don't insert nulls into attnotnull catalog column

2020-07-21 Thread Tom Lane
Assert that we don't insert nulls into attnotnull catalog columns. The executor checks for this error, and so does the bootstrap catalog loader, but we never checked for it in retail catalog manipulations. The folly of that has now been exposed, so let's add assertions checking it. Checking in Ca

pgsql: Assert that we don't insert nulls into attnotnull catalog column

2020-07-21 Thread Tom Lane
Assert that we don't insert nulls into attnotnull catalog columns. The executor checks for this error, and so does the bootstrap catalog loader, but we never checked for it in retail catalog manipulations. The folly of that has now been exposed, so let's add assertions checking it. Checking in Ca

pgsql: Assert that we don't insert nulls into attnotnull catalog column

2020-07-21 Thread Tom Lane
Assert that we don't insert nulls into attnotnull catalog columns. The executor checks for this error, and so does the bootstrap catalog loader, but we never checked for it in retail catalog manipulations. The folly of that has now been exposed, so let's add assertions checking it. Checking in Ca

pgsql: Assert that we don't insert nulls into attnotnull catalog column

2020-07-21 Thread Tom Lane
Assert that we don't insert nulls into attnotnull catalog columns. The executor checks for this error, and so does the bootstrap catalog loader, but we never checked for it in retail catalog manipulations. The folly of that has now been exposed, so let's add assertions checking it. Checking in Ca

pgsql: Be more careful about marking catalog columns NOT NULL by defaul

2020-07-21 Thread Tom Lane
Be more careful about marking catalog columns NOT NULL by default. The bug fixed in commit 72eab84a5 would not have occurred if initdb had a less surprising rule about which columns should be marked NOT NULL by default. Let's make that rule be strictly that the column must be fixed-width and its

pgsql: Minor glossary tweaks

2020-07-21 Thread Alvaro Herrera
Minor glossary tweaks Add "(process)" qualifier to two terms, remove self-reference in one term. Author: Jürgen Purtz Discussion: https://postgr.es/m/[email protected] Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/ac25e7b039d5e

pgsql: Minor glossary tweaks

2020-07-21 Thread Alvaro Herrera
Minor glossary tweaks Add "(process)" qualifier to two terms, remove self-reference in one term. Author: Jürgen Purtz Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a0b2d583db9f040e2c15

pgsql: Glossary: Add term "base backup"

2020-07-21 Thread Alvaro Herrera
Glossary: Add term "base backup" Author: Jürgen Purtz Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/606c3845988ddd9497cbbbf6fc559b91c76ed65d Modified Files -- doc/src/sgml/

pgsql: Avoid C99-ism in pre-v12 branches.

2020-07-21 Thread Tom Lane
Avoid C99-ism in pre-v12 branches. Per buildfarm (I need to figure out why my own compiler did not whine about this). Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/22b96f883fe2a454476b4d5fd69ee46b15889169 Modified Files -- src/backend/catalog/i

pgsql: Avoid C99-ism in pre-v12 branches.

2020-07-21 Thread Tom Lane
Avoid C99-ism in pre-v12 branches. Per buildfarm (I need to figure out why my own compiler did not whine about this). Branch -- REL_10_STABLE Details --- https://git.postgresql.org/pg/commitdiff/a00dbfaeed4017bca695a3e77d0f6264ba94a4c1 Modified Files -- src/backend/catalog/i

pgsql: Weaken type-OID-matching checks in array_recv and record_recv.

2020-07-21 Thread Tom Lane
Weaken type-OID-matching checks in array_recv and record_recv. Rather than always insisting on an exact match of the type OID in the data to the element type or column type we expect, complain only when both OIDs fall within the manually-assigned range. This acknowledges the reality that user-def

pgsql: Add nbtree Valgrind buffer lock checks.

2020-07-21 Thread Peter Geoghegan
Add nbtree Valgrind buffer lock checks. Holding just a buffer pin (with no buffer lock) on an nbtree buffer/page provides very weak guarantees, especially compared to heapam, where it's often safe to read a page while only holding a buffer pin. This commit has Valgrind enforce the following rule:

pgsql: neqjoinsel must now pass through collation to eqjoinsel.

2020-07-21 Thread Tom Lane
neqjoinsel must now pass through collation to eqjoinsel. Since commit 044c99bc5, eqjoinsel passes the passed-in collation to any operators it invokes. However, neqjoinsel failed to pass on whatever collation it got, so that if we invoked a collation-dependent operator via that code path, we'd get

pgsql: neqjoinsel must now pass through collation to eqjoinsel.

2020-07-21 Thread Tom Lane
neqjoinsel must now pass through collation to eqjoinsel. Since commit 044c99bc5, eqjoinsel passes the passed-in collation to any operators it invokes. However, neqjoinsel failed to pass on whatever collation it got, so that if we invoked a collation-dependent operator via that code path, we'd get

pgsql: neqjoinsel must now pass through collation to eqjoinsel.

2020-07-21 Thread Tom Lane
neqjoinsel must now pass through collation to eqjoinsel. Since commit 044c99bc5, eqjoinsel passes the passed-in collation to any operators it invokes. However, neqjoinsel failed to pass on whatever collation it got, so that if we invoked a collation-dependent operator via that code path, we'd get

pgsql: Fix comment in sha2.h

2020-07-21 Thread Michael Paquier
Fix comment in sha2.h An incorrect reference to SHA-1 was present. Author: Daniel Gustafsson Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e47c2602aa4d35a4e3eb6ada40454c6c0f1279bf Modi

pgsql: Fix conversion table generator scripts.

2020-07-21 Thread Thomas Munro
Fix conversion table generator scripts. convutils.pm used implicit conversion of undefined value to integer zero. Some of conversion scripts are susceptible to regexp greediness. Fix, avoiding whitespace changes in the output. Also update ICU URLs that moved. No need to back-patch, because the

pgsql: Fix corner case with PGP decompression in pgcrypto

2020-07-21 Thread Michael Paquier
Fix corner case with PGP decompression in pgcrypto A compressed stream may end with an empty packet, and PGP decompression finished before reading this empty packet in the remaining stream. This caused a failure in pgcrypto, handling this case as corrupted data. This commit makes sure to consume

pgsql: Fix corner case with PGP decompression in pgcrypto

2020-07-21 Thread Michael Paquier
Fix corner case with PGP decompression in pgcrypto A compressed stream may end with an empty packet, and PGP decompression finished before reading this empty packet in the remaining stream. This caused a failure in pgcrypto, handling this case as corrupted data. This commit makes sure to consume

pgsql: Fix corner case with PGP decompression in pgcrypto

2020-07-21 Thread Michael Paquier
Fix corner case with PGP decompression in pgcrypto A compressed stream may end with an empty packet, and PGP decompression finished before reading this empty packet in the remaining stream. This caused a failure in pgcrypto, handling this case as corrupted data. This commit makes sure to consume

pgsql: Fix corner case with PGP decompression in pgcrypto

2020-07-21 Thread Michael Paquier
Fix corner case with PGP decompression in pgcrypto A compressed stream may end with an empty packet, and PGP decompression finished before reading this empty packet in the remaining stream. This caused a failure in pgcrypto, handling this case as corrupted data. This commit makes sure to consume

pgsql: Fix corner case with PGP decompression in pgcrypto

2020-07-21 Thread Michael Paquier
Fix corner case with PGP decompression in pgcrypto A compressed stream may end with an empty packet, and PGP decompression finished before reading this empty packet in the remaining stream. This caused a failure in pgcrypto, handling this case as corrupted data. This commit makes sure to consume

pgsql: Fix corner case with PGP decompression in pgcrypto

2020-07-21 Thread Michael Paquier
Fix corner case with PGP decompression in pgcrypto A compressed stream may end with an empty packet, and PGP decompression finished before reading this empty packet in the remaining stream. This caused a failure in pgcrypto, handling this case as corrupted data. This commit makes sure to consume

pgsql: Fix corner case with PGP decompression in pgcrypto

2020-07-21 Thread Michael Paquier
Fix corner case with PGP decompression in pgcrypto A compressed stream may end with an empty packet, and PGP decompression finished before reading this empty packet in the remaining stream. This caused a failure in pgcrypto, handling this case as corrupted data. This commit makes sure to consume