Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YapGd-0007V2-Mh for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Mar 2015 17:38:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YapGd-0003Yy-4v for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Mar 2015 17:38:59 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YapGc-0003Yp-3M for pgsql-bugs@postgresql.org; Wed, 25 Mar 2015 17:38:58 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YapGZ-0003zA-7g for pgsql-bugs@postgresql.org; Wed, 25 Mar 2015 17:38:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t2PHcq9e007723; Wed, 25 Mar 2015 13:38:52 -0400 From: Tom Lane To: Jaimin Pan cc: pgsql-bugs@postgresql.org Subject: Re: [Report Bug With Patch] Rel Cache Bug In-reply-to: References: Comments: In-reply-to Jaimin Pan message dated "Wed, 25 Mar 2015 21:59:17 +0800" Date: Wed, 25 Mar 2015 13:38:52 -0400 Message-ID: <7722.1427305132@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Jaimin Pan writes: > I think there is a bug in rel cache rebuild of release 9.4.1. > it also exists on some other release. > the issue was introduced by 491dd4a97daa6b4de9ee8401ada10ad5da76af46 > -- a/src/backend/utils/cache/relcache.c > +++ b/src/backend/utils/cache/relcache.c > @@ -2166,9 +2166,9 @@ RelationClearRelation(Relation relation, bool rebuild) > /* ... but actually, we don't have to update newrel->rd_rel > */ > memcpy(relation->rd_rel, newrel->rd_rel, CLASS_TUPLE_SIZE); > /* preserve old tupledesc and rules if no logical change */ > - if (keep_tupdesc) > + if (!keep_tupdesc) > SWAPFIELD(TupleDesc, rd_att); > - if (keep_rules) > + if (!keep_rules) > { > SWAPFIELD(RuleLock *, rd_rules); > SWAPFIELD(MemoryContext, rd_rulescxt); You would need to provide a fairly convincing argument why you think that five-year-old code is backwards. Asserting there's a problem with absolutely zero evidence is not likely to impress anyone. (For the record, it did and does still look right to me. As per the comment about thirty lines up, what we're doing is un-swapping the fields we don't want to change. If keep_tupdesc is true, we don't want to change rd_att, so we need to swap its old value back. Likewise for the other thing.) regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs