Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qj427-0098oq-AB for pgsql-general@arkaria.postgresql.org; Wed, 20 Sep 2023 20:42:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qj425-002zSA-Lv for pgsql-general@arkaria.postgresql.org; Wed, 20 Sep 2023 20:42:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qj425-002zRt-9u for pgsql-general@lists.postgresql.org; Wed, 20 Sep 2023 20:42:49 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qj422-006Nug-Cn for pgsql-general@lists.postgresql.org; Wed, 20 Sep 2023 20:42:48 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40472c3faadso2525925e9.2 for ; Wed, 20 Sep 2023 13:42:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20230601.gappssmtp.com; s=20230601; t=1695242565; x=1695847365; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=sJ74syec8O2wtsjZoU3NmePKKwNC3sM7Ughgm7mX3M4=; b=VE8sAp5xx3VNMh/W8L3JhLjft7VnjNlm/AO4G6guSpr/9AK4sVI9lzFhggWoH7Gcbr 0SuIEyuwJaw0/hEui1GvXUVbFStYsOeuZCj5k/g205i4/DyV6GDKA/XDyNZRu8rFrnEr lFisq1cHpHAK8Trx95EU9wbKhhvGMtavip4L6/giu4DVEg1zw8/P7ciOMjB5mc+SBdKR FA4l1jLXC8VQ5XNkIJ0gTTepvCYqSqiSB/Mn53jpcmXwuwoacXcQ/g+5KNl68A6YUSFZ YgyNfBLIlvgsBdKuDwXDhCeqSfcu7Nn5fxfDqo5AzZQcFyOLZb7pjhkoQwhPcHZVhVbF 6l8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695242565; x=1695847365; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=sJ74syec8O2wtsjZoU3NmePKKwNC3sM7Ughgm7mX3M4=; b=XPCGn6KMoii2aOyFBDWucDiE3l7KxxNFPNSPwTgZq86AFqjsSNX4bQHlfLKzLXpGji kvv4vuxyYz+CmWFlUKIfbmB7iakO2bUkZNEENDSERJq++elV0RmAoDVigFM4xQRcC4g1 rYcKQxJ0qThUQ554hoZDW6TFqFa8kPYhNDeYgmxWxK5ITdh02G22K4EZlLbuKPLGNppk IuMscLLrn9qiATVGuy/tYQO1EG9SNON/kj5Q+SWpK631MKzlYZJ3fO1vK6qzAoDn4dhG ObQ7mTRWfmfQAFvrpSPWOo3TF9Qu+jfH7RgsFysCanzLmPmNHhi6BCUSwjZ/PnNGkMTK QT1g== X-Gm-Message-State: AOJu0Yxyha+grtK5EPscels1b8B/TihhwbD9vxrr1SALDu4NfoptrevU PLi4Fsf1KdRawLCl/p9gF0fkPyXQqYB19eUxI7k= X-Google-Smtp-Source: AGHT+IHOMrk+hdyFWwDqh0jByCM9skOkVjmdtNMcMNl8OsV0mJ3XWf7YCLfmm/eosHRxoPFyramulw== X-Received: by 2002:a05:600c:21da:b0:3fe:2b8c:9f0b with SMTP id x26-20020a05600c21da00b003fe2b8c9f0bmr3230136wmj.23.1695242565189; Wed, 20 Sep 2023 13:42:45 -0700 (PDT) Received: from localhost.localdomain (178-190-177-183.adsl.highway.telekom.at. [178.190.177.183]) by smtp.gmail.com with ESMTPSA id v21-20020a7bcb55000000b00404719b05b5sm46976wmj.27.2023.09.20.13.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 13:42:44 -0700 (PDT) Message-ID: Subject: Re: trouble restoring a database backed up with pg_dump/pg_dump_all - relations are created in the wrong order From: Laurenz Albe To: Harry Green , "pgsql-general@lists.postgresql.org" Date: Wed, 20 Sep 2023 22:42:44 +0200 In-Reply-To: <1814194178.6529176.1695232793334@mail.yahoo.com> References: <73791286.4632684.1695049729344.ref@mail.yahoo.com> <73791286.4632684.1695049729344@mail.yahoo.com> <11b8ca504cd625d45d561c9a1b69700f1ec5ef55.camel@cybertec.at> <1814194178.6529176.1695232793334@mail.yahoo.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2023-09-20 at 17:59 +0000, Harry Green wrote: > I have done a complete pg_dump and complete restore, and tried all forms = of complete > pg_dumps and restores (i.e. the different formats). There is no partial o= r tables only > or data only dumping or restoring. Further, you refer to a 'check constra= int' but > this is just a function that we wrote with the 'create function...' comma= nd, whose > name if memory serves correctly happens to begin by 'check...' because th= at happens > to be the most descriptive word for what it does.=C2=A0 >=20 > The pg_restore is actually correctly recreating the function using the 'c= reate function...' > command, but it is doing so on line 95, ahead of the 'create table ... ac= counts ...' > which appears on line 510. The trouble is that in the function itself, we= refer to > the accounts table, and if I am not mistaken, the whole point of pl/pgsql= is that > you can refer to tables, etc. so I don't think I have done anything 'ille= gal'. Ok, so my conjecture about check constraints was wrong. The fact remains that you have to restore the dump into an empty database. Then these errors should not occur. Yours, Laurenz Albe