Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOtDY-0004bm-NJ for pgsql-general@arkaria.postgresql.org; Fri, 19 Aug 2022 04:02:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oOtDX-0008Hv-0s for pgsql-general@arkaria.postgresql.org; Fri, 19 Aug 2022 04:02:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOtDW-0008He-Ge for pgsql-general@lists.postgresql.org; Fri, 19 Aug 2022 04:02:42 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oOtDU-0007DX-AP for pgsql-general@postgresql.org; Fri, 19 Aug 2022 04:02:41 +0000 Received: by mail-pf1-x436.google.com with SMTP id q19so3287182pfg.8 for ; Thu, 18 Aug 2022 21:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=UQurr8QgoUirbm16o9+IjZO6S9LrB3YhBNL/1Nt1VD4=; b=UBtSQ/GyYGg/VDJoMQqPzjOUYngqBRncaJ0Nh2iGGf/+FbtUsZ746KRBs1eq5nED+x daPkNlrZARZYhZp0NwNeWpPF3jNKDE3EADz9FA9I4r7vgTD3EBZNIiqzKKaa3QWlHdpV ik7ttqznRDB4LeAkd8xtyarEWyMk89KtFjZH0QcQrpvophWrAV/LXYhEnBI9ASkAMf7u dMA7yb7U8mfQ/qZBAkcT4Q2r+dfP2qXDZcgH6vFRd5FT8tEGwS91fTWii/rm60I/lSWO cucsvWF9cB1p8RluUbnUGmfAToRYsarSBA5bdfhLvjWiEBNDkezIlStPRfwkCSTSjjJk MZZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=UQurr8QgoUirbm16o9+IjZO6S9LrB3YhBNL/1Nt1VD4=; b=CVK3M5ok7mDbbdJ8A+z9A6tSbaKok2KFPbFsk3muXvUmhABnBldcMJYjXAvoQp4LZy CqjZYJIqX9PcOUfBMaKfjVIXx7vn7+HRJgiAjebM1lh3tBOj9wjkPgz0A1GVcDpLcCP8 pBpc/jObG3Mfou2bOwRW4yNzrOIP1IDQdv2lWV+a+WnUattMHbLY339oteweZ5h6ezt1 tTkf2r/U3XKZRdFtlyVF9uh7Yq1okMv9vswfMLRW5w1Fsvt1tRrvaml36VUuODSLOMFO Y9ITtkWklZSJV0bUAhzHFahzY3+yqqTS4xUCdbFZXsIMoikO59ENwFMaM2Qu+TZ5xtUy v/gQ== X-Gm-Message-State: ACgBeo0jEWchyNLYtp3wK3DUZkL41t9cTkjt/0pWx49riIRoOfv46ELv aH7g42vImEGGWHBb/f+1drY= X-Google-Smtp-Source: AA6agR5UWuuZ+cXyvnQFooehx8iqzn19D+ciXiGg/yG22eifN+Z4luxuP2woWBzFDbDZ6kMhlve6qg== X-Received: by 2002:a63:5fc2:0:b0:429:fe35:1bd6 with SMTP id t185-20020a635fc2000000b00429fe351bd6mr4641762pgb.315.1660881759154; Thu, 18 Aug 2022 21:02:39 -0700 (PDT) Received: from jrouhaud (2001-b011-1005-f3c1-9429-4274-d207-4f7a.dynamic-ip6.hinet.net. [2001:b011:1005:f3c1:9429:4274:d207:4f7a]) by smtp.gmail.com with ESMTPSA id d2-20020a170902cec200b0016c5306917fsm2204191plg.53.2022.08.18.21.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 21:02:38 -0700 (PDT) Date: Fri, 19 Aug 2022 12:02:34 +0800 From: Julien Rouhaud To: milist ujang Cc: pgsql-general@postgresql.org Subject: Re: ERROR: catalog is missing 3 attribute(s) for relid 150243 Message-ID: <20220819040234.ossib2ixphaolhz2@jrouhaud> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Please don't top-post on this list (and please trim quoted messages too). On Fri, Aug 19, 2022 at 05:55:03AM +0700, milist ujang wrote: > On Thu, Aug 18, 2022 at 5:33 PM milist ujang wrote: > > > > 3rd query ERROR same as subject (ERROR: catalog is missing 3 attribute(s) > > for relid 150243) > > my version is 12.9 on x86_64. > > reading source code, got the message form RelationBuildTupleDesc() function: > > /* > * end the scan and close the attribute relation > */ > systable_endscan(pg_attribute_scan); > table_close(pg_attribute_desc, AccessShareLock); > > if (need != 0) > elog(ERROR, "pg_attribute catalog is missing %d attribute(s) for > relation OID %u", > need, RelationGetRelid(relation)); > > I'm not sure whether this function will compare the mentioned relation > attribute in pg_attribute and physical table (header) file? No, this function is comparing pg_class.relnatts to rows fetched querying pg_attribute for the given relation. What it means is that you likely have data corruption. You could try to reindex pg_attribute and see if that fixes that specific problems, but even if it does you will have to investigate how data got corrupted, fix that root problem, and then try to check for other corrupted data or restore from a sane backup.