pgsql: Change "long" numGroups fields to be Cardinality (i.e., double).

2025-11-02 Thread Tom Lane
Change "long" numGroups fields to be Cardinality (i.e., double). We've been nibbling away at removing uses of "long" for a long time, since its width is platform-dependent. Here's one more: change the remaining "long" fields in Plan nodes to Cardinality, since the three surviving examples all rep

pgsql: Improve planner's estimates of tuple hash table sizes.

2025-11-02 Thread Tom Lane
Improve planner's estimates of tuple hash table sizes. For several types of plan nodes that use TupleHashTables, the planner estimated the expected size of the table as basically numEntries * (MAXALIGN(dataWidth) + MAXALIGN(SizeofHeapTupleHeader)). This is pretty far off, especially for small data

pgsql: Document nbtree row comparison design.

2025-11-02 Thread Peter Geoghegan
Document nbtree row comparison design. Add comments explaining when and where it is safe for nbtree to treat row compare keys as if they were simple scalar inequality keys on the row's most significant column. This is particularly important within _bt_advance_array_keys, which deals with required

pgsql: Document nbtree row comparison design.

2025-11-02 Thread Peter Geoghegan
Document nbtree row comparison design. Add comments explaining when and where it is safe for nbtree to treat row compare keys as if they were simple scalar inequality keys on the row's most significant column. This is particularly important within _bt_advance_array_keys, which deals with required

pgsql: Remove obsolete nbtree equality key comments.

2025-11-02 Thread Peter Geoghegan
Remove obsolete nbtree equality key comments. _bt_first reliably uses the same equality key (on each index column) for initial positioning purposes as the one that _bt_checkkeys can use to end the scan following commit f09816a0. _bt_first no longer applies its own independent rules to determine w

pgsql: Remove obsolete nbtree equality key comments.

2025-11-02 Thread Peter Geoghegan
Remove obsolete nbtree equality key comments. _bt_first reliably uses the same equality key (on each index column) for initial positioning purposes as the one that _bt_checkkeys can use to end the scan following commit f09816a0. _bt_first no longer applies its own independent rules to determine w

pgsql: Avoid mixing void and integer in a conditional expression.

2025-11-02 Thread Tom Lane
Avoid mixing void and integer in a conditional expression. The C standard says that the second and third arguments of a conditional operator shall be both void type or both not-void type. The Windows version of INTERRUPTS_PENDING_CONDITION() got this wrong. It's pretty harmless because the resul

pgsql: Avoid mixing void and integer in a conditional expression.

2025-11-02 Thread Tom Lane
Avoid mixing void and integer in a conditional expression. The C standard says that the second and third arguments of a conditional operator shall be both void type or both not-void type. The Windows version of INTERRUPTS_PENDING_CONDITION() got this wrong. It's pretty harmless because the resul

pgsql: Avoid mixing void and integer in a conditional expression.

2025-11-02 Thread Tom Lane
Avoid mixing void and integer in a conditional expression. The C standard says that the second and third arguments of a conditional operator shall be both void type or both not-void type. The Windows version of INTERRUPTS_PENDING_CONDITION() got this wrong. It's pretty harmless because the resul

pgsql: Avoid mixing void and integer in a conditional expression.

2025-11-02 Thread Tom Lane
Avoid mixing void and integer in a conditional expression. The C standard says that the second and third arguments of a conditional operator shall be both void type or both not-void type. The Windows version of INTERRUPTS_PENDING_CONDITION() got this wrong. It's pretty harmless because the resul

pgsql: Avoid mixing void and integer in a conditional expression.

2025-11-02 Thread Tom Lane
Avoid mixing void and integer in a conditional expression. The C standard says that the second and third arguments of a conditional operator shall be both void type or both not-void type. The Windows version of INTERRUPTS_PENDING_CONDITION() got this wrong. It's pretty harmless because the resul

pgsql: Avoid mixing void and integer in a conditional expression.

2025-11-02 Thread Tom Lane
Avoid mixing void and integer in a conditional expression. The C standard says that the second and third arguments of a conditional operator shall be both void type or both not-void type. The Windows version of INTERRUPTS_PENDING_CONDITION() got this wrong. It's pretty harmless because the resul

pgsql: Avoid mixing void and integer in a conditional expression.

2025-11-02 Thread Tom Lane
Avoid mixing void and integer in a conditional expression. The C standard says that the second and third arguments of a conditional operator shall be both void type or both not-void type. The Windows version of INTERRUPTS_PENDING_CONDITION() got this wrong. It's pretty harmless because the resul