Re: pg_class.reltype -> pg_type.oid missing for pg_toast table - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: pg_class.reltype -> pg_type.oid missing for pg_toast table
Date
Msg-id 752d608c-3026-4fb7-8c3f-a5271aa51cad@www.fastmail.com
Whole thread Raw
In response to Re: pg_class.reltype -> pg_type.oid missing for pg_toast table  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Deleting older versions in unique indexes to avoid page splits
Next
From: Peter Eisentraut
Date:
Subject: Re: [PATCH 1/1] Initial mach based shared memory support.