Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j29bH-0007zc-92 for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Feb 2020 08:11:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j29bG-0002SF-4O for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Feb 2020 08:11:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j29bF-0002S3-Ob for pgsql-hackers@lists.postgresql.org; Thu, 13 Feb 2020 08:11:53 +0000 Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j29bC-0001sa-8R for pgsql-hackers@postgresql.org; Thu, 13 Feb 2020 08:11:53 +0000 Received: by mail-yb1-xb43.google.com with SMTP id b6so2573147ybr.0 for ; Thu, 13 Feb 2020 00:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cpWUrwhIvuVN4JrPVcmaWYoEm6qHjulHhfv2HiA5bcE=; b=asmvEnEFSTdxGXV2EYp8OGZJZbXbIpPoNEcPzCp85dZWbD9aH4twK2chf97I2d3Rzi 14K99cOzlDFUHwvxJey00K+oTRzq8qnv62iky7ea5ulSbqdVQnxvvq7o9ymzWstfbzaE 3lE7PNbBlU2ve50Nx2BGwUI2UNLR1R+LoFz8DYCB26lC/FIZlDsjBK2Q1nX/sRMWfiLr pVPHbdXff35pQ8P44RAKH+fomAPQjAXZVpu5Sbo78qopQbQ0wbxlY2mmF70SZhiSnj2M UxbwpnCEVJ2+81LMcvepWN8iCXHmnGbCH17bTqZpxseqGg8xIgTMUUv21VwX58Cs1cV1 Oz2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cpWUrwhIvuVN4JrPVcmaWYoEm6qHjulHhfv2HiA5bcE=; b=fMlO+QB2JRY+OLxTLDcs4b9UooFduWax6pETeamgIM0YFjfpa+7+w9c1zbC3zNaka6 lIpSmm6kxQXwA21+jIVH7XtyzToZwfvsrW198eOmj3X1WIe875MC9oBJyv4x2bhOffCX UMp6kI6XmJxDnmFltj8RNdZ/vrVb6YL3TWUBYxSZnwpslrbdg/4MlyqC+UVM7mQ4zjVi pmTH+u7vK6V4MjHvNrkvqXMiBmt4DRMONX6FZUXoI9ogYqqc1Ni3aB52WPuqI5Ly/Aol RIxxy+uROwboAxSk7D63bhR2/y3qJAM5G4roGVsM/i7yzLbgi02Wqv128GLIpGvHYsnR PNhQ== X-Gm-Message-State: APjAAAUSFAXVdDV4/G07CXscXeyiSTA3xWw/JDw3CXn5X/SE0BrwWldY kfehnwGUxBCU9Pqh+xH0YzrWQw== X-Google-Smtp-Source: APXvYqweOP2S2uVREvQTR2YbHdxGQ6UllWa/W0dsJLu6/Ecum2S2GtbAlb3q2PmLgJM9Z+YoSj0Gog== X-Received: by 2002:a25:9781:: with SMTP id i1mr2273099ybo.518.1581581508341; Thu, 13 Feb 2020 00:11:48 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id p6sm825826ywi.63.2020.02.13.00.11.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Feb 2020 00:11:47 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 11A0A800925; Thu, 13 Feb 2020 02:11:45 -0600 (CST) Date: Thu, 13 Feb 2020 02:11:45 -0600 From: Justin Pryzby To: Amit Langote Cc: Alvaro Herrera , pgsql-hackers@postgresql.org Subject: Re: assert pg_class.relnatts is consistent Message-ID: <20200213081145.GA1412@telsasoft.com> References: <20200212182337.GZ1412@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Feb 13, 2020 at 04:51:01PM +0900, Amit Langote wrote: > On Thu, Feb 13, 2020 at 3:23 AM Justin Pryzby wrote: > > Forking this thread for two tangential patches which I think are more > > worthwhile than the original topic's patch. > > https://www.postgresql.org/message-id/20200207143935.GP403%40telsasoft.com > > > > Is there a better place to implement assertion from 0002 ? > > I would think the answer to that would be related to the answer of why > you think we need this assert in the first place? > > I know I have made the mistake of not updating relnatts when I added > relispartition, etc. to pg_class, only to be bitten by it in the form > of seemingly random errors/crashes. Is that why? Right. If adding or removing a column from pg_class (or others) it's necessary not only to add the column in the .h file, and update references like Anum_*, but also to update that catalog's own pg_class.relnatts in pg_class.dat. On the other thead, Alvaro agreed it might be worth experimenting with moving "indisclustered" from boolean in pg_index to an Oid in pg_class. There's not many references to it, so I was able to make most of the necessary changes within an hour .. but spent some multiple of that tracing the crash in initdb, which I would prefer to have failed less obscurely. -- Justin