postgresql/src/backend
Tom Lane 680d540502 Avoid unnecessary failure in SELECT concurrent with ALTER NO INHERIT.
If a query against an inheritance tree runs concurrently with an ALTER
TABLE that's disinheriting one of the tree members, it's possible to get
a "could not find inherited attribute" error because after obtaining lock
on the removed member, make_inh_translation_list sees that its columns
have attinhcount=0 and decides they aren't the columns it's looking for.

An ideal fix, perhaps, would avoid including such a just-removed member
table in the query at all; but there seems no way to accomplish that
without adding expensive catalog rechecks or creating a likelihood of
deadlocks.  Instead, let's just drop the check on attinhcount.  In this
way, a query that's included a just-disinherited child will still
succeed, which is not a completely unreasonable behavior.

This problem has existed for a long time, so back-patch to all supported
branches.  Also add an isolation test verifying related behaviors.

Patch by me; the new isolation test is based on Kyotaro Horiguchi's work.

Discussion: https://postgr.es/m/20170626.174612.23936762.horiguchi.kyotaro@lab.ntt.co.jp
2018-01-12 15:46:37 -05:00
..
access Change some bogus PageGetLSN calls to BufferGetLSNAtomic 2018-01-09 17:06:31 -03:00
bootstrap Update copyright for 2018 2018-01-02 23:30:12 -05:00
catalog Remove hard-coded schema knowledge about pg_attribute from genbki.pl 2018-01-12 11:21:42 -03:00
commands Add QueryEnvironment to ExplainOneQuery_hook's parameter list. 2018-01-11 12:16:18 -05:00
executor Revert "Move portal pinning from PL/pgSQL to SPI" 2018-01-10 16:01:17 -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 Another attempt at fixing build with various OpenSSL versions 2018-01-04 19:09:27 -05:00
main Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Rewrite list_qsort() to avoid trashing its input list. 2018-01-09 13:25:53 -05:00
optimizer Avoid unnecessary failure in SELECT concurrent with ALTER NO INHERIT. 2018-01-12 15:46:37 -05:00
parser Don't allow VACUUM VERBOSE ANALYZE VERBOSE. 2018-01-09 10:20:48 -05:00
po
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 Latin spelling 2018-01-11 08:32:01 -05: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 Remove PortalGetQueryDesc() 2018-01-09 13:47:56 -05:00
tsearch Update copyright for 2018 2018-01-02 23:30:12 -05:00
utils Fix Latin spelling 2018-01-11 08:32:01 -05:00
.gitignore
common.mk
Makefile Update copyright for 2018 2018-01-02 23:30:12 -05:00
nls.mk