Petr Jelinek <petr@2ndquadrant.com> writes:
> On 2015-07-23 02:01, Tom Lane wrote:
>> This needs to work more like LIMIT, which doesn't try to compute the
>> limit parameters until the first fetch. So what we need is an Init
>> function that does very darn little indeed (maybe we don't even need
>> it at all), and then a ParamInspect function that is called at first fetch
>> or during a ReScan, and that one is the one that gets to look at the
>> evaluated parameter values.
> If we replace the Begin and ReScan interfaces by single interface the
> Init would definitely be optional (all it would do so far is palloc the
> tsmdata which can be done easily in the new interface if tsmdata is
> NULL). I don't like the ParamInspect name as that function needs to
> setup the state for the sampling method (and that's true no matter if we
> have Init or not), I think something like BeginScan works better, but it
> must be clearly documented that it's called for ReScan as well.
OK, so "InitSampleScan" for a function called at ExecInitSampleScan time
(which we might as well make optional), and then we'll use BeginSampleScan
for the function that gets the parameters. The restart/ReScan function
goes away since BeginSampleScan will take its place.
regards, tom lane