postgresql/src/backend/access
Alvaro Herrera 8b08f7d482 Local partitioned indexes
When CREATE INDEX is run on a partitioned table, create catalog entries
for an index on the partitioned table (which is just a placeholder since
the table proper has no data of its own), and recurse to create actual
indexes on the existing partitions; create them in future partitions
also.

As a convenience gadget, if the new index definition matches some
existing index in partitions, these are picked up and used instead of
creating new ones.  Whichever way these indexes come about, they become
attached to the index on the parent table and are dropped alongside it,
and cannot be dropped on isolation unless they are detached first.

To support pg_dump'ing these indexes, add commands
    CREATE INDEX ON ONLY <table>
(which creates the index on the parent partitioned table, without
recursing) and
    ALTER INDEX ATTACH PARTITION
(which is used after the indexes have been created individually on each
partition, to attach them to the parent index).  These reconstruct prior
database state exactly.

Reviewed-by: (in alphabetical order) Peter Eisentraut, Robert Haas, Amit
	Langote, Jesper Pedersen, Simon Riggs, David Rowley
Discussion: https://postgr.es/m/20171113170646.gzweigyrgg6pwsg4@alvherre.pgsql
2018-01-19 11:49:22 -03:00
..
brin Update copyright for 2018 2018-01-02 23:30:12 -05:00
common Local partitioned indexes 2018-01-19 11:49:22 -03:00
gin Update copyright for 2018 2018-01-02 23:30:12 -05:00
gist Change some bogus PageGetLSN calls to BufferGetLSNAtomic 2018-01-09 17:06:31 -03:00
hash Update copyright for 2018 2018-01-02 23:30:12 -05:00
heap Local partitioned indexes 2018-01-19 11:49:22 -03:00
index Local partitioned indexes 2018-01-19 11:49:22 -03:00
nbtree Change some bogus PageGetLSN calls to BufferGetLSNAtomic 2018-01-09 17:06:31 -03:00
rmgrdesc Update copyright for 2018 2018-01-02 23:30:12 -05:00
spgist Update copyright for 2018 2018-01-02 23:30:12 -05:00
tablesample Update copyright for 2018 2018-01-02 23:30:12 -05:00
transam Transfer state pertaining to pending REINDEX operations to workers. 2018-01-19 07:48:54 -05:00
Makefile TABLESAMPLE, SQL Standard and extensible 2015-05-15 14:37:10 -04:00