pgsql: Simplify useless 0L constants

2023-03-28 Thread Peter Eisentraut
Simplify useless 0L constants In ancient times, these belonged to arguments or fields that were actually of type long, but now they are not anymore, so this "L" decoration is just confusing. (Some other 0L and other "L" constants remain, where they are actually associated with a long type.) Bran

pgsql: Avoid syncing data twice for the 'publish_via_partition_root' op

2023-03-28 Thread Amit Kapila
Avoid syncing data twice for the 'publish_via_partition_root' option. When there are multiple publications for a subscription and one of those publishes via the parent table by using publish_via_partition_root and the other one directly publishes the child table, we end up copying the same data tw

pgsql: Add XML ID attributes to create_subscription.sgml.

2023-03-28 Thread Amit Kapila
Add XML ID attributes to create_subscription.sgml. Commit ecb696527c added an XML ID attribute to one varlistentry in create_subscription.sgml. Following 78ee60ed84, this commit adds XML ID attributes to all varlistentries in create_subscription.sgml. Additionally, links are added to refer to the

pgsql: pg_dump: Fix gzip compression of empty data

2023-03-28 Thread Tomas Vondra
pg_dump: Fix gzip compression of empty data The pg_dump Compressor API has three basic callbacks - Allocate, Write and End. The gzip implementation (since e9960732a) wrongly assumed the Write function would always be called, and deferred the initialization of the internal compression system until

pgsql: Validate ICU locales.

2023-03-28 Thread Jeff Davis
Validate ICU locales. For ICU collations, ensure that the locale's language exists in ICU, and that the locale can be opened. Basic validation helps avoid minor mistakes and misspellings, which often fall back to the root locale instead of the intended locale. It's even more important to avoid su

pgsql: amcheck: In verify_heapam, allows tuples with xmin 0.

2023-03-28 Thread Robert Haas
amcheck: In verify_heapam, allows tuples with xmin 0. Commit e88754a1965c0f40a723e6e46d670cacda9e19bd caused that case to be reported as corruption, but Peter Geoghegan pointed out that it can legitimately happen in the case of a speculative insertion that aborts, so we'd better not flag it as cor

pgsql: amcheck: In verify_heapam, allows tuples with xmin 0.

2023-03-28 Thread Robert Haas
amcheck: In verify_heapam, allows tuples with xmin 0. Commit e88754a1965c0f40a723e6e46d670cacda9e19bd caused that case to be reported as corruption, but Peter Geoghegan pointed out that it can legitimately happen in the case of a speculative insertion that aborts, so we'd better not flag it as cor

pgsql: amcheck: In verify_heapam, allows tuples with xmin 0.

2023-03-28 Thread Robert Haas
amcheck: In verify_heapam, allows tuples with xmin 0. Commit e88754a1965c0f40a723e6e46d670cacda9e19bd caused that case to be reported as corruption, but Peter Geoghegan pointed out that it can legitimately happen in the case of a speculative insertion that aborts, so we'd better not flag it as cor

pgsql: Fix recent pg_walinspect fpi_length bug.

2023-03-28 Thread Peter Geoghegan
Fix recent pg_walinspect fpi_length bug. Commit 0276ae42dd taught pg_walinspect's pg_get_wal_record_info() function to output NULLs rather than empty strings for its record description and block_ref output parameters. However, it inadvertently moved the function call that sets fpi_length until af

pgsql: Fix corner-case planner failure for MERGE.

2023-03-28 Thread Tom Lane
Fix corner-case planner failure for MERGE. MERGE planning could fail with "variable not found in subplan target list" if the target table is partitioned and all its partitions are excluded at plan time, or in the case where it has no partitions but used to have some. This happened because distrib

pgsql: Fix corner-case planner failure for MERGE.

2023-03-28 Thread Tom Lane
Fix corner-case planner failure for MERGE. MERGE planning could fail with "variable not found in subplan target list" if the target table is partitioned and all its partitions are excluded at plan time, or in the case where it has no partitions but used to have some. This happened because distrib

pgsql: Fix error inconsistency in older ICU versions.

2023-03-28 Thread Jeff Davis
Fix error inconsistency in older ICU versions. To support older ICU versions, we rely on icu_set_collation_attributes() to do error checking that is handled directly by ucol_open() in newer ICU versions. Commit 3b50275b12 introduced a slight inconsistency, where the error report includes the fixed

pgsql: initdb: replace check_icu_locale() with default_icu_locale().

2023-03-28 Thread Jeff Davis
initdb: replace check_icu_locale() with default_icu_locale(). The extra checks done in check_icu_locale() are not necessary. An existing comment already pointed out that the checks would be done during post-bootstrap initialization, when the locale is opened by the backend. This was a mistake in c

pgsql: initdb: emit message when using default ICU locale.

2023-03-28 Thread Jeff Davis
initdb: emit message when using default ICU locale. Helpful to determine from test logs whether the locale came from the environment or a command-line option. Discussion: https://postgr.es/m/04182066-7655-344a-b8b7-040b1b2490fb%40enterprisedb.com Reviewed-by: Peter Eisentraut Branch -- mast

pgsql: Save a few bytes in pg_attribute

2023-03-28 Thread Peter Eisentraut
Save a few bytes in pg_attribute Change the columns attndims, attstattarget, and attinhcount from int32 to int16, and reorder a bit. This saves some space (currently 4 bytes) in pg_attribute and tuple descriptors, which translates into small performance benefits and/or room for new columns in pg_