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 1jb4Ee-0004mK-Ly for pgsql-bugs@arkaria.postgresql.org; Tue, 19 May 2020 15:32:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jb4Ed-0001Tr-JX for pgsql-bugs@arkaria.postgresql.org; Tue, 19 May 2020 15:32:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jb4Ed-0001Tk-7I for pgsql-bugs@lists.postgresql.org; Tue, 19 May 2020 15:32:51 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jb4EW-0005gg-A4 for pgsql-bugs@lists.postgresql.org; Tue, 19 May 2020 15:32:50 +0000 Received: by mail-qt1-x844.google.com with SMTP id v4so11487276qte.3 for ; Tue, 19 May 2020 08:32:43 -0700 (PDT) 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=7sOGK7DXqvWeWisCpafQyDMJkWaG+9ZrViga8c3uhIg=; b=At1JrUYINh93ArbtQW1OxiTpQteG6oThhy7hNvqjebH6La3j18CLqvpFQ9tUaXVJ1y 8ZMXmCbNQZaUKAH2eVaWfLYZLtcpGF4ct5mH3E+oy8cSpWiMoMdlm9I0tX8DbibGXfp7 eHlYY9Wa/YQcY2HKybQGrKEbvQSYtts2+8xz/l1c+zMIXAEd+eoSqnAJN+Dmaz5oSGh4 oiG+/mhvg96Yt6C1gfhBBq12UcQqJe7m3U882q6uIX9tyrTpSY6wS8Jra2iMcAjUDo9t /Yisqcjm+fyCZJkHIgZfNbDm4281NMBI0LHTUBFeUtQYF1ZW47dqxlynjIIgsX6lS2S8 qcfA== 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=7sOGK7DXqvWeWisCpafQyDMJkWaG+9ZrViga8c3uhIg=; b=irLOtQF46tvuKRcz6qB3MbrUpNH9hNB15xbzWabjP7EsRCoB8ZW/DyKE2DUM2/n3/o SgQcyXcKu18Ly5chBDuJUaWBgA+FbHFYJ1Uvbb4Yt2nQYNuNMQ7rG4xi+Cxw1RU+XsHW iMr2oFph88OHONwJystWTtOB/Vcs/mgrFAxFOs6bG7BU6DoEn6wm0y+cSW5LT952nfSW SP0rURL/f8478DOeH4Nb2vF9Q1eECQpkY15TO9fnw9Q+uXV/8Ujkv4iiK2ZF0XpS1OfK Q41SH+h21t+gh/VB+Bv30sZrP3WEj50eTNoybXmWXR40PCi2ZU38pVyWRTgKVqgsLMFJ afhw== X-Gm-Message-State: AOAM531VAHrVRg0nfi2lqyBi2HuZG8dz4d+aTZ2SHvguG1XhknkaV1Pc XAyY4/ehldXlzeX4RdqnXL8w8Q== X-Google-Smtp-Source: ABdhPJxfsMKLpvw6GPRPE7r+bPuaFsk9avjOdz7Coxm5Obr39sY6gONUGPfrvAbhjv6z45xNcx6v3g== X-Received: by 2002:aed:3949:: with SMTP id l67mr229032qte.313.1589902362605; Tue, 19 May 2020 08:32:42 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id a24sm8487qto.10.2020.05.19.08.32.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 08:32:41 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 850D43007EE; Tue, 19 May 2020 11:32:39 -0400 (-04) Date: Tue, 19 May 2020 11:32:39 -0400 From: Alvaro Herrera To: shawn wang Cc: wenjing , Tom Lane , pgsql-bugs@lists.postgresql.org, tushar Subject: Re: [bug] Table not have typarray when created by single user mode Message-ID: <20200519153239.GA17266@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-May-19, shawn wang wrote: > Although single-user mode is used for bootstrapping by initdb. Sometimes it > is used for debugging or disaster recovery. > However, it is still possible for users to process data in this mode. If > only the table is deleted, > I worry that it will cause inconvenience to the user. > I don't understand why we must be IsUnderPostmaster to create an array type > too. > If we could create an array type in single-user mode, there is not this > issue. Looking at the code again, there is one other possible solution: remove the ereport(ERROR) from AssignTypeArrayOid. This means that we'll return InvalidOid and the array type will be marked as 0 in the upgraded cluster ... which is exactly the case in the original server. (Of course, when array_oid is returned as invalid, the creation of the array should be skipped, in callers of AssignTypeArrayOid.) I think the argument to have that error check there, is that it's a cross-check to avoid pg_upgrade bugs for cases where binary_upgrade_next_array_type_oid is not set when it should have been set. But I think we've hammered the pg_upgrade code sufficiently now, that we don't need that check anymore. Any bugs that result in that behavior will be very evident by lack of consistency on some upgrade anyway. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services