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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: wenjing <wjzeng2012(at)gmail(dot)com>
Cc: 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-04-13 14:51:16
Message-ID: 32412.1586789476@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

wenjing <wjzeng2012(at)gmail(dot)com> writes:
> Use single user mode (t_create_by_standalone) typarray = 0, but use psql t_create_by_psql typarray has oid.

That's because of this in heap_create_with_catalog:

/*
* Decide whether to create an array type over the relation's rowtype. We
* 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.
*/
if (IsUnderPostmaster && (relkind == RELKIND_RELATION ||
relkind == RELKIND_VIEW ||
relkind == RELKIND_MATVIEW ||
relkind == RELKIND_FOREIGN_TABLE ||
relkind == RELKIND_COMPOSITE_TYPE ||
relkind == RELKIND_PARTITIONED_TABLE))
new_array_oid = AssignTypeArrayOid();

Admittedly, "!IsUnderPostmaster" is not exactly the same thing as "running
during initdb", but I do not consider this a bug. You generally should
not be using single-user mode for anything except disaster recovery.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2020-04-13 14:58:29 BUG #16358: formas web site sql
Previous Message Fabien COELHO 2020-04-13 14:17:21 Re: pg_isready bug

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2020-04-13 14:56:11 Re: pg_validatebackup -> pg_verifybackup?
Previous Message Amit Khandekar 2020-04-13 14:46:36 Re: spin_delay() for ARM