Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WPcl6-0003sD-TZ for pgsql-bugs@arkaria.postgresql.org; Mon, 17 Mar 2014 18:59:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WPcl6-0008Fr-DA for pgsql-bugs@arkaria.postgresql.org; Mon, 17 Mar 2014 18:59:36 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WPcl4-0008EE-Q9 for pgsql-bugs@postgresql.org; Mon, 17 Mar 2014 18:59:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WPcl2-0006ci-FQ for pgsql-bugs@postgresql.org; Mon, 17 Mar 2014 18:59:34 +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 s2HIxUvS025727; Mon, 17 Mar 2014 14:59:30 -0400 From: Tom Lane To: jeff@pgexperts.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #9606: pg_class relhaspkey column not updated on removal of primary key In-reply-to: <20140317185255.20724.49675@wrigleys.postgresql.org> References: <20140317185255.20724.49675@wrigleys.postgresql.org> Comments: In-reply-to jeff@pgexperts.com message dated "Mon, 17 Mar 2014 18:52:55 -0000" Date: Mon, 17 Mar 2014 14:59:30 -0400 Message-ID: <25726.1395082770@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 jeff@pgexperts.com writes: > [ $SUBJECT ] This is not a bug; please read the description of pg_class: relhaspkey bool True if the table has (or once had) a primary key The note at the bottom of the page explains why: Several of the Boolean flags in pg_class are maintained lazily: they are guaranteed to be true if that's the correct state, but may not be reset to false immediately when the condition is no longer true. For example, relhasindex is set by CREATE INDEX, but it is never cleared by DROP INDEX. Instead, VACUUM clears relhasindex if it finds the table has no indexes. This arrangement avoids race conditions and improves concurrency. 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