postgresql/src/backend
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
..
access Local partitioned indexes 2018-01-19 11:49:22 -03:00
bootstrap Local partitioned indexes 2018-01-19 11:49:22 -03:00
catalog Local partitioned indexes 2018-01-19 11:49:22 -03:00
commands Local partitioned indexes 2018-01-19 11:49:22 -03:00
executor Remove useless lookup of root partitioned rel in ExecInitModifyTable(). 2018-01-17 14:44:15 -05:00
foreign Update copyright for 2018 2018-01-02 23:30:12 -05:00
lib Update copyright for 2018 2018-01-02 23:30:12 -05:00
libpq Update comment 2018-01-18 19:36:34 -05:00
main Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Local partitioned indexes 2018-01-19 11:49:22 -03:00
optimizer Reorder C includes 2018-01-17 18:10:05 -05:00
parser Local partitioned indexes 2018-01-19 11:49:22 -03:00
po Translation updates 2017-08-07 13:55:34 -04:00
port Update copyright for 2018 2018-01-02 23:30:12 -05:00
postmaster Update copyright for 2018 2018-01-02 23:30:12 -05:00
regex Update copyright for 2018 2018-01-02 23:30:12 -05:00
replication Fix typo in recent commit 2018-01-19 06:36:17 +00:00
rewrite Update copyright for 2018 2018-01-02 23:30:12 -05:00
snowball Update copyright for 2018 2018-01-02 23:30:12 -05:00
statistics Update copyright for 2018 2018-01-02 23:30:12 -05:00
storage Fix Latin spelling 2018-01-11 08:32:01 -05:00
tcop Local partitioned indexes 2018-01-19 11:49:22 -03:00
tsearch Update copyright for 2018 2018-01-02 23:30:12 -05:00
utils Local partitioned indexes 2018-01-19 11:49:22 -03:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Update copyright for 2018 2018-01-02 23:30:12 -05:00
common.mk Add ICU_CFLAGS to global CPPFLAGS 2017-06-12 15:57:22 -04:00
nls.mk Translation updates 2017-05-15 12:19:54 -04:00