Re: [bug] Table not have typarray when created by single user mode

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: shawn wang <shawn(dot)wang(dot)pg(at)gmail(dot)com>
Cc: wenjing <wjzeng2012(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)lists(dot)postgresql(dot)org, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>
Subject: Re: [bug] Table not have typarray when created by single user mode
Date: 2020-05-19 15:32:39
Message-ID: 20200519153239.GA17266@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-05-19 16:09:28 Re: [bug] Table not have typarray when created by single user mode
Previous Message Juan José Santamaría Flecha 2020-05-19 14:22:00 Re: BUG #16453: Not able to load a 10gb file.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-05-19 15:34:57 Re: Extension ownership and misuse of SET ROLE/SET SESSION AUTHORIZATION
Previous Message Tom Lane 2020-05-19 15:32:10 Re: factorial function/phase out postfix operators?