Hi,
so here is version 11.
Addressing Tomas' comments:
>
> 1) The documentation of the pg_tablesample_method catalog is missing
> documentation of the 'tsmpagemode' column, which was added later.
>
Fixed.
> 2) transformTableEntry() in parse_clause modifies the comment, in a way
> that made sense before part of the code was moved to a separate
> function. I suggest to revert the comment changes, and instead add
> the comment to transformTableSampleEntry()
>
Fixed.
> 3) The "shared" parts of the block sampler in sampling.c (e.g. in
> BlockSampler_Next) reference Vitter's algorithm (both the code and
> comments) which is a bit awkward as the only part that uses it is
> analyze.c. The other samplers using this code (system / bernoulli)
> don't use Vitter's algorithm.
>
Actually the Vitter's reservoir is implemented by
reservoir_init_selection_state and reservoir_get_next_S functions in the
sampling.c and is used by analyze, file_fdw and postgres_fdw. It was
previously exported from analyze.h/c but I think it's better to have it
together with the block sampling so that we have all the sampling
methods together.
As I mentioned before in this thread I fixed the REPEATABLE keyword
issue and fixed alias (AS) positioning in parser.
I also attached skeleton docs for the API, it could use more work, but I
am afraid I won't come up with something significantly better soon.
--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services