pgsql: Fix bogus affix-merging code.

2018-04-12 Thread Tom Lane
Fix bogus affix-merging code. NISortAffixes() compared successive compound affixes incorrectly, thus possibly failing to merge identical affixes, or (less likely) merging ones that shouldn't be merged. The user-visible effects of this are unclear, to me anyway. Per bug #15150 from Alexander

pgsql: Fix bogus affix-merging code.

2018-04-12 Thread Tom Lane
Fix bogus affix-merging code. NISortAffixes() compared successive compound affixes incorrectly, thus possibly failing to merge identical affixes, or (less likely) merging ones that shouldn't be merged. The user-visible effects of this are unclear, to me anyway. Per bug #15150 from Alexander

pgsql: Fix bogus affix-merging code.

2018-04-12 Thread Tom Lane
Fix bogus affix-merging code. NISortAffixes() compared successive compound affixes incorrectly, thus possibly failing to merge identical affixes, or (less likely) merging ones that shouldn't be merged. The user-visible effects of this are unclear, to me anyway. Per bug #15150 from Alexander

pgsql: Fix bogus affix-merging code.

2018-04-12 Thread Tom Lane
Fix bogus affix-merging code. NISortAffixes() compared successive compound affixes incorrectly, thus possibly failing to merge identical affixes, or (less likely) merging ones that shouldn't be merged. The user-visible effects of this are unclear, to me anyway. Per bug #15150 from Alexander

pgsql: Revert lowering of lock level for ATTACH PARTITION

2018-04-12 Thread Alvaro Herrera
Revert lowering of lock level for ATTACH PARTITION I lowered the lock level for partitions being scanned from AccessExclusive to ShareLock in the course of 72cf7f310c07, but that was bogus, as pointed out by Robert Haas. Revert that bit. Doing this is possible, but requires more work.

pgsql: Add comment about default partition in check_new_partition_bound

2018-04-12 Thread Alvaro Herrera
Add comment about default partition in check_new_partition_bound The intention of the test is not immediately obvious, so we need this much. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/181ccbb5e49cdc628e0c8334a9ed57dbc736efe8 Modified Files --

pgsql: YA attempt to stabilize the results of the postgres_fdw regressi

2018-04-12 Thread Tom Lane
YA attempt to stabilize the results of the postgres_fdw regression test. We've made multiple attempts to stabilize the plans shown by commit 1bc0100d2, with little success so far. The reason for the remaining instability seems to be that if a transaction (such as auto-analyze) is running

pgsql: Use the right memory context for partkey's FmgrInfo

2018-04-12 Thread Alvaro Herrera
Use the right memory context for partkey's FmgrInfo We were using CurrentMemoryContext to put the partsupfunc fmgr_info into, which isn't right, because we want the PartitionKey as a whole to be in the isolated Relation->rd_partkeycxt context. This can cause a crash with user-defined support

pgsql: Use the right memory context for partkey's FmgrInfo

2018-04-12 Thread Alvaro Herrera
Use the right memory context for partkey's FmgrInfo We were using CurrentMemoryContext to put the partsupfunc fmgr_info into, which isn't right, because we want the PartitionKey as a whole to be in the isolated Relation->rd_partkeycxt context. This can cause a crash with user-defined support

pgsql: Fix YA parallel-make hazard, this one in "make check" in plpytho

2018-04-12 Thread Tom Lane
Fix YA parallel-make hazard, this one in "make check" in plpython. We have to ensure that submake-generated-headers is finished before the topmost make run launches any child makes. Discussion: https://postgr.es/m/20180411235843.gg32...@paquier.xyz Branch -- master Details ---

pgsql: Fix interference between covering indexes and partitioned tables

2018-04-12 Thread Teodor Sigaev
Fix interference between covering indexes and partitioned tables The bug is caused due to the original IndexStmt that DefineIndex receives being overwritten when processing the INCLUDE columns. Use separate list of index params to propagate to child tables. Add tests covering this case. Amit

pgsql: Cleanup covering infrastructure

2018-04-12 Thread Teodor Sigaev
Cleanup covering infrastructure - Explicitly forbids opclass, collation and indoptions (like DESC/ASC etc) for including columns. Throw an error if user points that. - Truncated storage arrays for such attributes to store only key atrributes, added assertion checks. - Do not check opfamily

Re: pgsql: Support partition pruning at execution time

2018-04-12 Thread David Rowley
On 11 April 2018 at 18:58, David Rowley wrote: > On 10 April 2018 at 08:55, Tom Lane wrote: >> Alvaro Herrera writes: >>> David Rowley wrote: Okay, I've written and attached a fix for this. I'm not 100% certain

pgsql: Revert MERGE patch

2018-04-12 Thread Simon Riggs
Revert MERGE patch This reverts commits d204ef63776b8a00ca220adec23979091564e465, 83454e3c2b28141c0db01c7d2027e01040df5249 and a few more commits thereafter (complete list at the end) related to MERGE feature. While the feature was fully functional, with sufficient test coverage and necessary

pgsql: Rename IndexInfo.ii_KeyAttrNumbers array

2018-04-12 Thread Teodor Sigaev
Rename IndexInfo.ii_KeyAttrNumbers array Rename ii_KeyAttrNumbers to ii_IndexAttrNumbers to prevent confusion with ii_NumIndexAttrs/ii_NumIndexKeyAttrs. ii_IndexAttrNumbers contains all attributes including "including" columns, not only key attribute. Discussion: