From: wenjing zeng <wjzeng2012@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: shawn wang <shawn.wang.pg@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-bugs@lists.postgresql.org, tushar <tushar.ahuja@enterprisedb.com>
Subject: Re: [bug] Table not have typarray when created by single user mode
Date: Thu, 21 May 2020 15:28:28 +0800
Message-ID: <ABF24C4F-5F44-423A-9EFC-1029CFCA16EC@gmail.com> (raw)
In-Reply-To: <983.1589904568@sss.pgh.pa.us>
References: <20200519153239.GA17266@alvherre.pgsql>
<983.1589904568@sss.pgh.pa.us>
> 2020年5月20日 上午12:09,Tom Lane <tgl@sss.pgh.pa.us> 写道:
>
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
>> 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.
>
> I don't buy that argument at all; that's a pretty critical cross-check
> IMO, because it's quite important that pg_upgrade control all type OIDs
> assigned in the new cluster. And I think it's probably easier to
> break than you're hoping :-(
>
> I think a safer fix is to replace the IsUnderPostmaster check in
> heap_create_with_catalog with !IsBootstrapProcessingMode() or the
> like. That would have the result that we'd create array types for
> the information_schema views, as well as the system views made in
> system_views.sql, which is slightly annoying but probably no real
> harm in the big scheme of things. (I wonder if we ought to reverse
> the sense of the adjacent relkind check, turning it into a blacklist,
> while at it.)
Thanks for your help, This method passed all regression tests and pg_upgrade checks.
It looks perfect.
Wenjing
>
> I remain however of the opinion that doing this sort of thing in
> single-user mode, or really much of anything beyond emergency
> vacuuming, is unwise.
>
> regards, tom lane
Attachments:incomplete_array_type_in_single_user_mode_v2.patch (application/octet-stream, 758B) downloaddiff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.cindex e393c93..ba5716b 100644--- a/src/backend/catalog/heap.c+++ b/src/backend/catalog/heap.c@@ -1272,8 +1272,10 @@ heap_create_with_catalog(const char *relname,
* do not create any array types for system catalogs (ie, those made
* during initdb). We do not create them where the use of a relation as
* such is an implementation detail: toast tables, sequences and indexes.
+ *+ * Only the Bootstrap mode is limited.
*/
- if (IsUnderPostmaster && (relkind == RELKIND_RELATION ||+ if (!IsBootstrapProcessingMode() && (relkind == RELKIND_RELATION ||
relkind == RELKIND_VIEW ||
relkind == RELKIND_MATVIEW ||
relkind == RELKIND_FOREIGN_TABLE ||
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: wjzeng2012@gmail.com, tgl@sss.pgh.pa.us, shawn.wang.pg@gmail.com, alvherre@2ndquadrant.com, tushar.ahuja@enterprisedb.com
Subject: Re: [bug] Table not have typarray when created by single user mode
In-Reply-To: <ABF24C4F-5F44-423A-9EFC-1029CFCA16EC@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox