postgresql/src
Alvaro Herrera 71a05b2232 Don't mark partitioned indexes invalid unnecessarily
When an indexes is created on a partitioned table using ONLY (don't
recurse to partitions), it gets marked invalid until index partitions
are attached for each table partition.  But there's no reason to do this
if there are no partitions ... and moreover, there's no way to get the
index to become valid afterwards, because all partitions that get
created/attached get their own index partition already attached to the
parent index, so there's no chance to do ALTER INDEX ... ATTACH PARTITION
that would make the parent index valid.

Fix by not marking the index as invalid to begin with.

This is very similar to 9139aa1942, but the pg_dump aspect does not
appear to be relevant until we add FKs that can point to PKs on
partitioned tables.  (I tried to cause the pg_upgrade test to break by
leaving some of these bogus tables around, but wasn't able to.)

Making this change means that an index that was supposed to be invalid
in the insert_conflict regression test is no longer invalid; reorder the
DDL so that the test continues to verify the behavior we want it to.

Author: Álvaro Herrera
Reviewed-by: Amit Langote
Discussion: https://postgr.es/m/20181203225019.2vvdef2ybnkxt364@alvherre.pgsql
2018-12-05 13:31:51 -03:00
..
backend Don't mark partitioned indexes invalid unnecessarily 2018-12-05 13:31:51 -03:00
bin Add some missing schema qualifications 2018-12-03 14:21:52 +09:00
common Make spelling of "acknowledgment" consistent 2018-10-15 10:06:45 +02:00
fe_utils Fix translation of special characters in psql's LaTeX output modes. 2018-11-26 17:32:51 -05:00
include Add log_statement_sample_rate parameter 2018-11-29 18:42:53 -03:00
interfaces Eliminate parallel-make hazard in ecpg/preproc. 2018-12-01 17:19:51 -05:00
makefiles Add PGXS options to control TAP and isolation tests, take two 2018-12-03 09:27:35 +09:00
pl Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
port Integrate recovery.conf into postgresql.conf 2018-11-25 16:33:40 +01:00
template Yet further rethinking of build changes for macOS Mojave. 2018-11-02 18:54:00 -04:00
test Don't mark partitioned indexes invalid unnecessarily 2018-12-05 13:31:51 -03:00
timezone Sync our copy of the timezone library with IANA release tzcode2018g. 2018-10-31 09:47:53 -04:00
tools Eliminate parallel-make hazard in ecpg/preproc. 2018-12-01 17:19:51 -05:00
tutorial Deduplicate "invalid input syntax" messages for various types. 2018-07-22 14:58:01 -07:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Remove useless symbol from Makefile.global. 2018-11-06 10:57:51 -05:00
Makefile.shlib Ensure static libraries have correct mod time even if ranlib messes it up. 2018-11-29 15:53:44 -05:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00