Re: pg_class.reltype -> pg_type.oid missing for pg_toast table

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg_class.reltype -> pg_type.oid missing for pg_toast table
Date: 2021-01-20 06:00:37
Message-ID: 752d608c-3026-4fb7-8c3f-a5271aa51cad@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 19, 2021, at 17:43, Tom Lane wrote:
>I'm too lazy to check the code right now, but my recollection is that we
>do not bother to make composite-type entries for toast tables. However,
>they should have reltype = 0 if so, so I'm not quite sure where the
>above failure is coming from.

My apologies, false alarm.

The problem turned out to be due to doing

CREATE TABLE catalog_fks.%1$I AS
SELECT * FROM pg_catalog.%1$I

which causes changes to e.g. pg_catalog.pg_class during the command is running.

Solved by instead using COPY ... TO to first copy catalogs to files on disk,
which doesn't cause changes to the catalogs,
and then using COPY .. FROM to copy the data into the replicated table structures.

/Joel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-01-20 06:10:54 Re: [PATCH 1/1] Initial mach based shared memory support.
Previous Message Peter Geoghegan 2021-01-20 05:28:36 Re: Deleting older versions in unique indexes to avoid page splits