Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oVxxO-0004E7-Ov for pgsql-novice@arkaria.postgresql.org; Wed, 07 Sep 2022 16:31:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oVxxM-0002On-0a for pgsql-novice@arkaria.postgresql.org; Wed, 07 Sep 2022 16:31:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oVxxL-0002Oe-NF for pgsql-novice@lists.postgresql.org; Wed, 07 Sep 2022 16:31:15 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oVxxJ-0002Do-DT for pgsql-novice@postgresql.org; Wed, 07 Sep 2022 16:31:15 +0000 Received: by mail-ej1-x62b.google.com with SMTP id y3so31671829ejc.1 for ; Wed, 07 Sep 2022 09:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :from:to:cc:subject:date; bh=5W856Sp55QJGWiHg4YxTacfqBdzhNiulQdzPET70MuM=; b=ZpEj0XrZOBfvjg9dqJ0VCcYSUbgN0Kw/F4I/tiTSzzN7b4yGkEojxE6tW0kHOmO+oF jYCpur3p3V7rPuuiLZyn4p/pLyRnL9RXQHdzs+4bi7F8UUMAnwJnEovZVKD//RLESkUs 0EPzmDFldIMPVErrpxrywZHUMmmnAg7KzICb/kk2XALcocc+N9Jt6g2zMM0hVeUBb5dY Goo5iBDqU+2NWeFZpoHuEXydIAC95FhXuwfBSGF1xF+F+dV0ujUdJEV9tPFIlPB6/t5R /ZhW6YJKzi72FbwiPp+pF1Pd0S+E/kwW9PYEPqqO2bUIWxE1DQ8uMnnZoT39GPnRChaO JXFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :x-gm-message-state:from:to:cc:subject:date; bh=5W856Sp55QJGWiHg4YxTacfqBdzhNiulQdzPET70MuM=; b=VFWH0ywBuEc7Kz/3TxqNe79g2cFCeuayokBeD0GDStUXYdKdHfuM1dqB+H0IuaPEXO B8CWPHQiwk2xgw40Q6iaFo/CFJT+jnt+WURxZp8jOXxHaoIlpYDWReRZOHjG5IIkwYGX WitqPwYzGsWhIDZn+yvi5LIOktCCoQxy09T6Kbx+kgRcAILqmXkL/deACgL56nBKQNM8 dqSzUcu9+OjVQb0rIfwKMN4XgSW8ZRw3S8RQ3Y8zkDWWPHOinrXhcItjxvOc9yBVd43U zgwGUG9PzvrRO/q+brHN0pKwwGGuJn7sO8QL64iZls6VJr9YtQSGjUoCBIBHnQihw1nI brcQ== X-Gm-Message-State: ACgBeo2zuUITdqBZJ6/9VIRVPnBVxYkOsLeQYF3qFWknW5mx1RzaDaWe K0MJGWqBLEIBL9a1Jq1nc6OZp4vhNsJpsaN1KLJF5wTW X-Google-Smtp-Source: AA6agR7AZX97kDOGJ0M3vbUmkFZGBovhrqeQ4uH1wA0QA6c5IY7fIaqpsJ+5NNtNPXK2cFXSsTHs+PpIu/bE/aRiiLw= X-Received: by 2002:a17:907:7205:b0:770:86f1:ae6e with SMTP id dr5-20020a170907720500b0077086f1ae6emr1835147ejc.396.1662568272154; Wed, 07 Sep 2022 09:31:12 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:640c:2b09:b0:17f:2bb9:86ff with HTTP; Wed, 7 Sep 2022 09:31:11 -0700 (PDT) In-Reply-To: <20220907075018.GA3923@fables.co.za> References: <20220907075018.GA3923@fables.co.za> From: "David G. Johnston" Date: Wed, 7 Sep 2022 09:31:11 -0700 Message-ID: Subject: Re: restore overwrite? To: pgsql-novice Content-Type: multipart/alternative; boundary="00000000000046d66005e818d709" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000046d66005e818d709 Content-Type: text/plain; charset="UTF-8" On Wednesday, September 7, 2022, Anne Wainwright wrote: > Hi, > > I want to do a restore to write over the top of existing data. > > The unique key prevents this. Should I rather TRUNCATE the tables > concerned before the restore? That is a bit scary if the restore does > not work. Is there a better way. > > (This data on v.8.4.4 which is being moved to latest version 14). > > Thanks for answer in advance > > Anne > > If you cannot just do a simple restore into an empty v14 database you are probably better off not thinking of this as a restore operation but instead an ETL operation and write ETL code to extract data from the v8 database, do any necessary transforms (possibly within the v14 database but within a staging table), then merge the transformed data into the real v14 tables. David J. --00000000000046d66005e818d709 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Wednesday, September 7, 2022, Anne Wainwright <anotheranne@fables.co.za> wrote:
Hi,

I want to do a restore to write over the top of existing data.

The unique key prevents this. Should I rather TRUNCATE the tables
concerned before the restore? That is a bit scary if the restore does
not work. Is there a better way.

(This data on v.8.4.4 which is being moved to latest version 14).

Thanks for answer in advance

Anne


If you cannot just do a simple restore int= o an empty v14 database you are probably better off not thinking of this as= a restore operation but instead an ETL operation and write ETL code to ext= ract data from the v8 database, do any necessary transforms (possibly withi= n the v14 database but within a staging table), then merge the transformed = data into the real v14 tables.

David J.
= =C2=A0
--00000000000046d66005e818d709--