On Wed, 18 Mar 2020 at 15:57, Andy Fan <zhihui.fan1...@gmail.com> wrote: > I'm now writing the code for partition index stuff, which > is a bit of boring, since every partition may have different unique index.
Why is that case so different? For a partitioned table to have a valid unique index, a unique index must exist on each partition having columns that are a superset of the partition key columns. An IndexOptInfo will exist on the partitioned table's RelOptInfo, in this case. At the leaf partition level, wouldn't you just add the uniquekeys the same as we do for base rels? Maybe only do it if enable_partitionwise_aggregation is on. Otherwise, I don't think we'll currently have a need for them. Currently, we don't do unique joins for partition-wise joins. Perhaps uniquekeys will be a good way to fix that omission in the future.