pgsql: Fix slot type assumptions for nodeGather[Merge].

2018-11-15 Thread Andres Freund
Fix slot type assumptions for nodeGather[Merge]. The assumption made in 1a0586de3657c was wrong, as evidenced by buildfarm failure on locust, which runs with force_parallel_mode=regress. The tuples accessed in either nodes are in the outer slot, and we can't trivially rely on the slot type being

pgsql: Add dummy field to currently empty struct TupleTableSlotOps.

2018-11-15 Thread Andres Freund
Add dummy field to currently empty struct TupleTableSlotOps. Per MSVC complaint on buildfarm member dory. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f92cd7392386147f6a16787c1d5c78d0e9b7cf34 Modified Files -- src/include/executor/tuptable.h | 2 ++ 1

pgsql: Verify that expected slot types match returned slot types.

2018-11-15 Thread Andres Freund
Verify that expected slot types match returned slot types. This is important so JIT compilation knows what kind of tuple slot the deforming routine can expect. There's also optimization potential for expression initialization without JIT compilation. It e.g. seems plausible to elide EEOP_*_FETCHSO

pgsql: Don't generate tuple deforming functions for virtual slots.

2018-11-15 Thread Andres Freund
Don't generate tuple deforming functions for virtual slots. Virtual tuple table slots never need tuple deforming. Therefore, if we know at expression compilation time, that a certain slot will always be virtual, there's no need to create a tuple deforming routine for it. Author: Andres Freund Dis

pgsql: Compute information about EEOP_*_FETCHSOME at expression init ti

2018-11-15 Thread Andres Freund
Compute information about EEOP_*_FETCHSOME at expression init time. Previously this information was computed when JIT compiling an expression. But the information is useful for assertions in the non-JIT case too (for assertions), therefore it makes sense to move it. This will, in a followup comm

pgsql: Introduce notion of different types of slots (without implementi

2018-11-15 Thread Andres Freund
Introduce notion of different types of slots (without implementing them). Upcoming work intends to allow pluggable ways to introduce new ways of storing table data. Accessing those table access methods from the executor requires TupleTableSlots to be carry tuples in the native format of such stora

pgsql: Rejigger materializing and fetching a HeapTuple from a slot.

2018-11-15 Thread Andres Freund
Rejigger materializing and fetching a HeapTuple from a slot. Previously materializing a slot always returned a HeapTuple. As current work aims to reduce the reliance on HeapTuples (so other storage systems can work efficiently), that needs to change. Thus split the tasks of materializing a slot (i

pgsql: A small tweak to some comments for PartitionKeyData

2018-11-15 Thread Peter Eisentraut
A small tweak to some comments for PartitionKeyData It was not really that obvious that there's meant to be exactly 1 item in the partexprs List for each zero-valued partattrs element. Some incorrect code using these fields was the cause of CVE-2018-1052, so it's worthwhile to mention how they sh

pgsql: Update executor documentation for run-time partition pruning

2018-11-15 Thread Peter Eisentraut
Update executor documentation for run-time partition pruning With run-time partition pruning, there is no longer necessarily an executor node for each corresponding plan node. Author: David Rowley Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/fd5274a65b4f

pgsql: Correct code comments for PartitionedRelPruneInfo struct

2018-11-15 Thread Peter Eisentraut
Correct code comments for PartitionedRelPruneInfo struct The comments above the PartitionedRelPruneInfo struct incorrectly document how subplan_map and subpart_map are indexed. This seems to have snuck in on 4e232364033. Author: David Rowley Branch -- master Details --- https://git.po

pgsql: Correct code comments for PartitionedRelPruneInfo struct

2018-11-15 Thread Peter Eisentraut
Correct code comments for PartitionedRelPruneInfo struct The comments above the PartitionedRelPruneInfo struct incorrectly document how subplan_map and subpart_map are indexed. This seems to have snuck in on 4e232364033. Author: David Rowley Branch -- REL_11_STABLE Details --- https:/

pgsql: Update executor documentation for run-time partition pruning

2018-11-15 Thread Peter Eisentraut
Update executor documentation for run-time partition pruning With run-time partition pruning, there is no longer necessarily an executor node for each corresponding plan node. Author: David Rowley Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/86a4819f691ba08bef0

pgsql: Rationalize expression context reset in ExecModifyTable().

2018-11-15 Thread Andres Freund
Rationalize expression context reset in ExecModifyTable(). The current pattern of reseting expressions both in ExecProcessReturning() and ExecOnConflictUpdate() makes it harder than necessary to reason about memory lifetimes. It also requires materializing slots unnecessarily, although this patch

pgsql: Make reformat-dat-files, reformat-dat-files VPATH safe.

2018-11-15 Thread Andres Freund
Make reformat-dat-files, reformat-dat-files VPATH safe. The reformat_dat_file.pl script, added by 372728b0d49552641, supported all the necessary options to make it work in a VPATH build, but the makefile invocations didn't take VPATH into account. Fix that. Discussion: https://postgr.es/m/201811

pgsql: Make reformat-dat-files, reformat-dat-files VPATH safe.

2018-11-15 Thread Andres Freund
Make reformat-dat-files, reformat-dat-files VPATH safe. The reformat_dat_file.pl script, added by 372728b0d49552641, supported all the necessary options to make it work in a VPATH build, but the makefile invocations didn't take VPATH into account. Fix that. Discussion: https://postgr.es/m/201811

pgsql: Improve performance of partition pruning remapping a little.

2018-11-15 Thread Tom Lane
Improve performance of partition pruning remapping a little. ExecFindInitialMatchingSubPlans has to update the PartitionPruneState's subplan mapping data to account for the removal of subplans it prunes. However, that's only necessary if run-time pruning will also occur, so we can skip it when tha

pgsql: geo_ops.c: Clarify comments and function arguments

2018-11-15 Thread Alvaro Herrera
geo_ops.c: Clarify comments and function arguments These functions were not crystal clear about what their respective APIs are. Make an effort to improve that. Emre's patch was correct AFAICT, but I (Álvaro) felt the need to improve a few comments a bit more. Any resulting errors are my own. P