Re: [bug] Table not have typarray when created by single user mode - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: [bug] Table not have typarray when created by single user mode
Date
Msg-id 20200519153239.GA17266@alvherre.pgsql
Whole thread Raw
In response to Re: [bug] Table not have typarray when created by single user mode  (shawn wang <shawn.wang.pg@gmail.com>)
Responses Re: [bug] Table not have typarray when created by single user mode  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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



pgsql-bugs by date:

Previous
From: Juan José Santamaría Flecha
Date:
Subject: Re: BUG #16453: Not able to load a 10gb file.
Next
From: Tom Lane
Date:
Subject: Re: [bug] Table not have typarray when created by single user mode