pgsql: Fix newly introduced bug in slab.c

2022-12-21 Thread David Rowley
Fix newly introduced bug in slab.c d21ded75f changed the way slab.c works but introduced a bug that meant we could end up with the slab's curBlocklistIndex pointing to the wrong list. The condition which was checking for this was failing to account for two things: 1. The curBlocklistIndex could b

pgsql: Introduce float4in_internal

2022-12-21 Thread Andrew Dunstan
Introduce float4in_internal This is the guts of float4in, callable as a routine to input floats, which will be useful in an upcoming patch for allowing soft errors in the seg module's input function. A similar operation was performed some years ago for float8in in commit 50861cd683e. Reviewed by

pgsql: Fix contrib/seg to be more wary of long input numbers.

2022-12-21 Thread Tom Lane
Fix contrib/seg to be more wary of long input numbers. seg stores the number of significant digits in an input number in a "char" field. If char is signed, and the input is more than 127 digits long, the count can read out as negative causing seg_out() to print garbage (or, if you're really unluc

pgsql: Fix contrib/seg to be more wary of long input numbers.

2022-12-21 Thread Tom Lane
Fix contrib/seg to be more wary of long input numbers. seg stores the number of significant digits in an input number in a "char" field. If char is signed, and the input is more than 127 digits long, the count can read out as negative causing seg_out() to print garbage (or, if you're really unluc

pgsql: Fix contrib/seg to be more wary of long input numbers.

2022-12-21 Thread Tom Lane
Fix contrib/seg to be more wary of long input numbers. seg stores the number of significant digits in an input number in a "char" field. If char is signed, and the input is more than 127 digits long, the count can read out as negative causing seg_out() to print garbage (or, if you're really unluc

pgsql: Fix contrib/seg to be more wary of long input numbers.

2022-12-21 Thread Tom Lane
Fix contrib/seg to be more wary of long input numbers. seg stores the number of significant digits in an input number in a "char" field. If char is signed, and the input is more than 127 digits long, the count can read out as negative causing seg_out() to print garbage (or, if you're really unluc

pgsql: Fix contrib/seg to be more wary of long input numbers.

2022-12-21 Thread Tom Lane
Fix contrib/seg to be more wary of long input numbers. seg stores the number of significant digits in an input number in a "char" field. If char is signed, and the input is more than 127 digits long, the count can read out as negative causing seg_out() to print garbage (or, if you're really unluc

pgsql: Fix contrib/seg to be more wary of long input numbers.

2022-12-21 Thread Tom Lane
Fix contrib/seg to be more wary of long input numbers. seg stores the number of significant digits in an input number in a "char" field. If char is signed, and the input is more than 127 digits long, the count can read out as negative causing seg_out() to print garbage (or, if you're really unluc

pgsql: Add palloc_aligned() to allow aligned memory allocations

2022-12-21 Thread David Rowley
Add palloc_aligned() to allow aligned memory allocations This introduces palloc_aligned() and MemoryContextAllocAligned() which allow callers to obtain memory which is allocated to the given size and also aligned to the specified alignment boundary. The alignment boundaries may be any power-of-2

pgsql: Fix operator typo in tablecmds.c

2022-12-21 Thread Michael Paquier
Fix operator typo in tablecmds.c A bitwise operator was getting used on two bools in ATAddCheckConstraint() to track if constraints should be merged or not with the existing ones of a relation, though obviously this should use a boolean OR operator. This led to the same result, but let's be clean

pgsql: Add work-around for VA_ARGS_NARGS() on MSVC.

2022-12-21 Thread Thomas Munro
Add work-around for VA_ARGS_NARGS() on MSVC. The previous coding of VA_ARGS_NARGS() always returned 1 on Visual Studio, because it treats __VA_ARGS__ as a single token unless you jump through extra hoops. Newer compilers have an option to fix that. Add a comment about that so that we can remembe

pgsql: Remove dead code

2022-12-21 Thread Peter Eisentraut
Remove dead code The second appearance of NamespaceRelationId in this if-else chain is in error and can be removed. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/73bb72f0ca2833329b59ebaf9476be3be71e462f Modified Files -- src/backend/catalog/aclchk.c |