pgsql: Fix off-by-one error in txid_status().

2019-03-27 Thread Thomas Munro
Fix off-by-one error in txid_status(). The transaction ID returned by GetNextXidAndEpoch() is in the future, so we can't attempt to access its status or we might try to read a CLOG page that doesn't exist. The > vs >= confusion probably stemmed from the choice of a variable name containing the wo

pgsql: Fix off-by-one error in txid_status().

2019-03-27 Thread Thomas Munro
Fix off-by-one error in txid_status(). The transaction ID returned by GetNextXidAndEpoch() is in the future, so we can't attempt to access its status or we might try to read a CLOG page that doesn't exist. The > vs >= confusion probably stemmed from the choice of a variable name containing the wo

pgsql: Fix off-by-one error in txid_status().

2019-03-27 Thread Thomas Munro
Fix off-by-one error in txid_status(). The transaction ID returned by GetNextXidAndEpoch() is in the future, so we can't attempt to access its status or we might try to read a CLOG page that doesn't exist. The > vs >= confusion probably stemmed from the choice of a variable name containing the wo

pgsql: Improve error handling of column references in expression transf

2019-03-27 Thread Michael Paquier
Improve error handling of column references in expression transformation Column references are not allowed in default expressions and partition bound expressions, and are restricted as such once the transformation of their expressions is done. However, trying to use more complex column references

pgsql: Suppress uninitialized-variable warning.

2019-03-27 Thread Tom Lane
Suppress uninitialized-variable warning. Apparently Andres' compiler is smart enough to see that hpage must be initialized before use ... but mine isn't. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a51cc7e9e60701d31032669011adcda8b4621d93 Modified Files ---

pgsql: pgbench: doExecuteCommand -> executeMetaCommand

2019-03-27 Thread Alvaro Herrera
pgbench: doExecuteCommand -> executeMetaCommand The new function is only in charge of meta commands, not SQL commands. This change makes the code a little clearer: now all the state changes are effected by advanceConnectionState. It also removes one indent level, which makes the diff look bulkier

pgsql: Avoid passing query tlist around separately from root->processed

2019-03-27 Thread Tom Lane
Avoid passing query tlist around separately from root->processed_tlist. In the dim past, the planner kept the fully-processed version of the query targetlist (the result of preprocess_targetlist) in grouping_planner's local variable "tlist", and only grudgingly passed it to individual other routin

pgsql: Add support for multivariate MCV lists

2019-03-27 Thread Tomas Vondra
Add support for multivariate MCV lists Introduce a third extended statistic type, supported by the CREATE STATISTICS command - MCV lists, a generalization of the statistic already built and used for individual columns. Compared to the already supported types (n-distinct coefficients and functiona

Re: pgsql: Add support for multivariate MCV lists

2019-03-27 Thread Andres Freund
On 2019-03-27 19:02:01 +, Tomas Vondra wrote: > Add support for multivariate MCV lists > > Introduce a third extended statistic type, supported by the CREATE > STATISTICS command - MCV lists, a generalization of the statistic > already built and used for individual columns. > > Compared to th

Re: pgsql: Add support for multivariate MCV lists

2019-03-27 Thread Peter Geoghegan
On Wed, Mar 27, 2019 at 12:04 PM Andres Freund wrote: > Congrats, this was long in the making! +1 Buildfarm member aye-aye has a problem with this patch, though: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=aye-aye&dt=2019-03-27%2019%3A07%3A53 -- Peter Geoghegan

pgsql: Minor improvements for the multivariate MCV lists

2019-03-27 Thread Tomas Vondra
Minor improvements for the multivariate MCV lists The MCV build should always call get_mincount_for_mcv_list(), as the there is no other logic to decide whether the MCV list represents all the data. So just remove the (ngroups > nitems) condition. Also, when building MCV lists, the number of item

Re: pgsql: Add support for multivariate MCV lists

2019-03-27 Thread Tomas Vondra
On Wed, Mar 27, 2019 at 12:32:34PM -0700, Peter Geoghegan wrote: On Wed, Mar 27, 2019 at 12:04 PM Andres Freund wrote: Congrats, this was long in the making! +1 Thanks! I guess it's a Gordie Howe of our patches. Buildfarm member aye-aye has a problem with this patch, though: https://bui

pgsql: Use Pandoc also for plain-text documentation output

2019-03-27 Thread Peter Eisentraut
Use Pandoc also for plain-text documentation output The makefile rule for the (rarely used) plain-text output postgres.txt was still written to use lynx, but in 96b8b8b6f9d8de4af01a77797273ad88c7a8e32e, where the INSTALL file was switched to pandoc, the rest of the makefile support for lynx was re

Re: pgsql: Add support for multivariate MCV lists

2019-03-27 Thread Tomas Vondra
On Wed, Mar 27, 2019 at 09:13:46PM +0100, Tomas Vondra wrote: On Wed, Mar 27, 2019 at 12:32:34PM -0700, Peter Geoghegan wrote: On Wed, Mar 27, 2019 at 12:04 PM Andres Freund wrote: Congrats, this was long in the making! +1 Thanks! I guess it's a Gordie Howe of our patches. Buildfarm mem

pgsql: doc: Move htmlhelp output to subdirectory

2019-03-27 Thread Peter Eisentraut
doc: Move htmlhelp output to subdirectory This makes it behave more like the html output. That will make some subsequent changes across all output formats easier. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/477422c9d176784e90e630de3c92b4fae8590bd2 Modified Fil

pgsql: doc: Add some images

2019-03-27 Thread Peter Eisentraut
doc: Add some images Add infrastructure for having images in the documentation, in SVG format. Add two images to start with. See the included README file for instructions. Author: Jürgen Purtz Author: Peter Eisentraut Discussion: https://www.postgresql.org/message-id/flat/aaa54502-05c0-4ea5-

Re: pgsql: doc: Add some images

2019-03-27 Thread Alvaro Herrera
On 2019-Mar-27, Peter Eisentraut wrote: > doc: Add some images > > Add infrastructure for having images in the documentation, in SVG > format. Add two images to start with. See the included README file > for instructions. I think you need something like the attached. -- Álvaro Herrera

pgsql: Fix vpath build

2019-03-27 Thread Peter Eisentraut
Fix vpath build Skip doc/src/sgml/images/Makefile since the directory is not created. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/12bb35fc9b000d462b9bd6b8856e1884ef1bb3d7 Modified Files -- config/prep_buildtree | 2 +- 1 file changed, 1 insertion(+),

Re: pgsql: Add support for multivariate MCV lists

2019-03-27 Thread Tomas Vondra
On Wed, Mar 27, 2019 at 09:33:53PM +0100, Tomas Vondra wrote: On Wed, Mar 27, 2019 at 09:13:46PM +0100, Tomas Vondra wrote: On Wed, Mar 27, 2019 at 12:32:34PM -0700, Peter Geoghegan wrote: On Wed, Mar 27, 2019 at 12:04 PM Andres Freund wrote: Congrats, this was long in the making! +1 Tha

pgsql: tableam: Support for an index build's initial table scan(s).

2019-03-27 Thread Andres Freund
tableam: Support for an index build's initial table scan(s). To support building indexes over tables of different AMs, the scans to do so need to be routed through the table AM. While moving a fair amount of code, nearly all the changes are just moving code to below a callback. Currently the ran

Re: pgsql: Add support for multivariate MCV lists

2019-03-27 Thread David Fetter
On Wed, Mar 27, 2019 at 07:02:01PM +, Tomas Vondra wrote: > Add support for multivariate MCV lists Kudos! Best, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate

Re: pgsql: Add support for multivariate MCV lists

2019-03-27 Thread Andres Freund
Hi, On 2019-03-27 21:13:46 +0100, Tomas Vondra wrote: > On Wed, Mar 27, 2019 at 12:32:34PM -0700, Peter Geoghegan wrote: > > On Wed, Mar 27, 2019 at 12:04 PM Andres Freund wrote: > > > Congrats, this was long in the making! > > > > +1 > > > > Thanks! I guess it's a Gordie Howe of our patches.

Re: pgsql: Compute XID horizon for page level index vacuum on primary.

2019-03-27 Thread Thomas Munro
On Wed, Mar 27, 2019 at 1:06 PM Andres Freund wrote: > Compute XID horizon for page level index vacuum on primary. Hi Andres, I have a virtual machine running FreeBSD 12.0 on i386 on which contrib/test_decoding consistently self-deadlocks in the "rewrite" test, with the stack listed below. You

pgsql: Use FullTransactionId for the transaction stack.

2019-03-27 Thread Thomas Munro
Use FullTransactionId for the transaction stack. Provide GetTopFullTransactionId() and GetCurrentFullTransactionId(). The intended users of these interfaces are access methods that use xids for visibility checks but don't want to have to go back and "freeze" existing references some time later bef

pgsql: Add basic infrastructure for 64 bit transaction IDs.

2019-03-27 Thread Thomas Munro
Add basic infrastructure for 64 bit transaction IDs. Instead of inferring epoch progress from xids and checkpoints, introduce a 64 bit FullTransactionId type and use it to track xid generation. This fixes an unlikely bug where the epoch is reported incorrectly if the range of active xids wraps ar