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 1j2cuN-0002gz-AT for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Feb 2020 15:29:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j2cuM-00083c-23 for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Feb 2020 15:29:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j2cuL-00081J-Lx for pgsql-hackers@lists.postgresql.org; Fri, 14 Feb 2020 15:29:33 +0000 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j2cuI-0006vL-5m for pgsql-hackers@postgresql.org; Fri, 14 Feb 2020 15:29:32 +0000 Received: by mail-qv1-xf43.google.com with SMTP id o18so4445499qvf.1 for ; Fri, 14 Feb 2020 07:29:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=Blyn748EmTHIf8TmDYXJcOU4cDclaQCKPnrv02Abfks=; b=fmKkdVLXrPTahn4VbiVaY8SjH+Nvg5bHs+GvduIzc2/fAgfg4yzF74M2yZF1kVf+y/ yEJ98ahdL9b9ukXm/8OP4dnk9cHGCwyW0G9GuLyRmqmyNjh0ysckocEkMeLqvT0kgWm8 vevMgJgykPABXnGAhBz4N9zfh65dLsVHckT83Iy4YtHsnhas5tWQM0BhLzLBryb53vR0 m0N7J2jJpKEBoKZm2aTOmIKrznsab4vxgXbsTf3iUVS+ir8oIUxWrYyVFVuk94oOsWKe rQEYKM/ozh0mtj22U4+3O4RXHnQciXz1DHhh6KAYsikOaaaYNc2XlGzOgg+oUhYjsbK4 WLvA== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Blyn748EmTHIf8TmDYXJcOU4cDclaQCKPnrv02Abfks=; b=fKl6Rz/u59l8t6bgpC1fmGjDbs9W4IIB4p990q8Z8U/PwEAI8sXPfUpCyff27KHEOw N38GF0An+iKQDyfQf+WH209V4cpcZRz5OconXLpRI5hi7ILVOFd6nIXsAxEax4OitwXy XKt3O4qqruFohTlqcBKj8ouWtLkGiVrZjN11z1wjsk0q2YtsXf5BP5FW8eAkB8GYUGdQ kUkHes5ottCGhCboXvXuAPe/AdzaOoR/QcstWijxL3JkloYz0hOLCPf0k8Ham6JWbg+c yrVYeVxx511QTWsdCipcZ+8nYWsK2Zb4zUMqPeCXp6+U1MZZuZYkkdxbx7O+3/9kkH7v BGDw== X-Gm-Message-State: APjAAAVD+z1aSTubNjVfI5KjsvU3eBMe7IOG+C8dSSUDaVm4qMCdsSCw lcp9SxFwmpx6P6Y+s1GKsnjzCw== X-Google-Smtp-Source: APXvYqwU7FSlJZL1O3DK+lT/LlLojEj4oQq2mbdLD6xi92XjGq9uKInKkzdcP7jEke9SHaClAQngyw== X-Received: by 2002:a05:6214:1923:: with SMTP id es3mr2676610qvb.49.1581694169360; Fri, 14 Feb 2020 07:29:29 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([201.186.208.119]) by smtp.gmail.com with ESMTPSA id 135sm3477929qkj.55.2020.02.14.07.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 07:29:28 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id D497030068E; Fri, 14 Feb 2020 12:29:26 -0300 (-03) Date: Fri, 14 Feb 2020 12:29:26 -0300 From: Alvaro Herrera To: John Naylor Cc: Amit Langote , Tom Lane , Justin Pryzby , PostgreSQL-development Subject: Re: assert pg_class.relnatts is consistent Message-ID: <20200214152926.GA7006@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Feb-14, John Naylor wrote: > One possible objection to what I wrote above is that it adds a > different kind of special case, but in a sneaky way. Perhaps it would > be more principled to treat it the same as oid after all. If we do > that, it would help to add a comment that we can't treat relnatts like > pronangs, since we need more information than what's in each pg_class > row. How about something like this? (untested) # oids are a special case; ignore next if $attname eq 'oid'; # pg_class.relnatts is computed from pg_attribute rows; ignore next if $catname eq 'pg_class' and $attname eq 'relnatts'; # Raise error unless a value exists. die "strip_default_values: $catname.$attname undefined\n" if !defined $row->{$attname}; -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services