pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nunya Business <nb3425586@gmail.com>
To: pgsql-general@postgresql.org
Subject: PG 14.5 -- Impossible to restore dump due to interaction/order of views, functions, and generated columns
Date: Mon, 05 Dec 2022 19:49:40 +0000
Message-ID: <emad8fa821-2230-4b8b-893b-cb2b8b376e9b@81da44b0.com> (raw)

Good afternoon,

I've recently run into a weird issue that I'm trying to gather more data 
on before sending an official bug report on the off chance that it's 
already been addressed.

Within my schema there is a table that has a GENERATED ALWAYS column 
that calls a plpgsql function.  The called function has a "row type" 
variable declared that  references a view.  While the schema itself 
functions properly day to day, and pg_dumpall works as expected, the 
generated SQL fails to successfully execute.  The table in question is 
restored with no rows, and an error is generated during the COPY stating 
that the type does not exist.

The issue appears to be that the COPY statement for the data is trying 
to execute the function specified for the GENERATED ALWAYS column, and 
that function cannot run because the view that the function references 
does not yet exist.

The dump was made with: pg_dumpall -c --quote-all-identifiers 
--exclude-database=postgres --exclude-database=template0 
--exclude-database=template1

Is this a known or unknown issue, or am I just missing something?

Any insight is appreciated.  Please reply-all as I'm not currently 
subscribed to the list.  Thanks in advance!

view thread (3+ messages)  latest in thread

Message-ID: <emad8fa821-2230-4b8b-893b-cb2b8b376e9b@81da44b0.com>
Permalink:  ../emad8fa821-2230-4b8b-893b-cb2b8b376e9b@81da44b0.com/
Also on:    postgresql.org/message-id/emad8fa821-2230-4b8b-893b-cb2b8b376e9b@81da44b0.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: nb3425586@gmail.com
  Subject: Re: PG 14.5 -- Impossible to restore dump due to interaction/order of views, functions, and generated columns
  In-Reply-To: <emad8fa821-2230-4b8b-893b-cb2b8b376e9b@81da44b0.com>
  References: <emad8fa821-2230-4b8b-893b-cb2b8b376e9b@81da44b0.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox