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 1pIEqZ-0007A5-Jc for pgsql-general@arkaria.postgresql.org; Wed, 18 Jan 2023 20:15:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pIEqY-0007mp-Gb for pgsql-general@arkaria.postgresql.org; Wed, 18 Jan 2023 20:15:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pIEqX-0007kr-R0 for pgsql-general@lists.postgresql.org; Wed, 18 Jan 2023 20:15:46 +0000 Received: from cross.elm.relay.mailchannels.net ([23.83.212.46]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pIEqV-0002nH-3S for pgsql-general@lists.postgresql.org; Wed, 18 Jan 2023 20:15:44 +0000 X-Sender-Id: hostpapa|x-authuser|list.pg.gavan@pendari.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 1F5F95C1E38; Wed, 18 Jan 2023 20:15:41 +0000 (UTC) Received: from hp309.hostpapa.com (unknown [127.0.0.6]) (Authenticated sender: hostpapa) by relay.mailchannels.net (Postfix) with ESMTPA id 561CB5C1C2A; Wed, 18 Jan 2023 20:15:40 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1674072940; a=rsa-sha256; cv=none; b=4IoZmTFz1NzuCfVTOGuN1tmFs+k4HIS1buaOvMGYsyJ34D9z1z/mu5wQSTNXEWuHdY0LhR XKGC/mv+Md3jbtHxdMWUQdhwGYCdhkpJ0gycGjcb4QSFqkSEYMlWCLYpobQu8V/hUIa2bJ 8RC5Z+091LrEkZc/jESpXCfBL+hlih7EP/mSRZLtgqxMNQBfpMJVwTeIoL+Km+gOTo2zgz kmvRl91ZPWKu0YCTPjUkmza2qhPmAB3NcQba7tkLMni25qoozdlAuV+xJPBx4eyVcymDIi vGB8YtTP+L5zpvv9eStA9MktkwUynTtcjVXHV94fS8vLC72anyIiQTH4BscrEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1674072940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Lu8K6p3AQDUvY1TinXfVZaP8k4JXa8fM2fy52foazOQ=; b=JH2n2veeulVV61xyRnrX7D9A0CirLMCPcQOjZLlkqIsfumbN8cMoF+wHMDSfIjSodcEHN9 QkiGg9DD3o7kYAqvh+1poq0leZKUuStFB8L0/Ev5cXQxaM7QeDaUcR5ghB9jKfRyTHubaD y3bzmIcL7MXFZ03yQi3oZXzQ3Eawt1cu+rc79EagBBtIRmBp/XjpiorHVBxSd8F8MxrjiM yt9GUDb3hOTF6omkU33Z34FvgPjZlirJywlZDg3vGCCzo6dIrpUxXFJReYz8b4XPyys3mC TzNOKTk1i1M9D4xBa+D/2IPYEYlJl2RZxSJ7CvAw6eji0agXLe/AOclujIJaTg== ARC-Authentication-Results: i=1; rspamd-7cf955c847-hgtc9; auth=pass smtp.auth=hostpapa smtp.mailfrom=list.pg.gavan@pendari.org X-Sender-Id: hostpapa|x-authuser|list.pg.gavan@pendari.org X-MC-Relay: Neutral X-MailChannels-SenderId: hostpapa|x-authuser|list.pg.gavan@pendari.org X-MailChannels-Auth-Id: hostpapa X-Society-Glossy: 66fc258e551341f1_1674072940783_4022317923 X-MC-Loop-Signature: 1674072940783:408393848 X-MC-Ingress-Time: 1674072940783 Received: from hp309.hostpapa.com (hp309.hostpapa.com [69.90.160.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.103.24.68 (trex/6.7.1); Wed, 18 Jan 2023 20:15:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pendari.org ; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References :In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Lu8K6p3AQDUvY1TinXfVZaP8k4JXa8fM2fy52foazOQ=; b=Iex/g98VEpswCKJlTL+IfiJQad Zw+Puvv/OiAZtSuKnBPGkpOzat5rV7N68/lemVg0RpSrEKgjJzM/sWQCf41uYVyahzSgousODJ+zA fcu/fyPTe6tpt+Eyl0WAbnY96UTG8gQATOUyzcSEg+wh4ETaaTJLRWZrLpkEiQ4GBmdC6WwVtiMpE YTMFpxgWPRm99h5pXxgVN3eOQvPJU1LW0MMI6Anb95A2o2nMQRNQRxzKyepC2QnNCjVXQpb8BhLNb L9Oh0tK4BikVqraDQ0jVDpeyWMqGB0GMcINrUx82FqDYV16QcnW5zfvvnBt759OR0+9apCwHU519K nq17XB2g==; Received: from [206.83.118.87] (port=22817 helo=[192.168.20.23]) by hp309.hostpapa.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pIEqQ-00A6d6-C7; Thu, 19 Jan 2023 07:15:39 +1100 From: Gavan Schneider To: pgsql-general@lists.postgresql.org Cc: Peter , Peter Subject: Re: Tools for moving normalized data around Date: Thu, 19 Jan 2023 07:15:23 +1100 X-Mailer: MailMate (1.14r5933) Message-ID: <26DC1033-FC6F-40C4-8E92-D90506FF9AD9@pendari.org> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-AuthUser: list.pg.gavan@pendari.org List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 19 Jan 2023, at 6:47, Peter wrote: > Now I want to grab some part of the data, on a certain condition > (let's say all records belonging to user 'Bob', if there is a "user" > table somewhere at the tree-bottom), and move it to another database > with the very same layout - which is already populated with data > and runs a different instance of the same application. > > Grabbing the intended records is just some dead-simple Selects. But > then inserting them into the other database is not fun, because some > primary keys will likely collide. > A very small sliver in this problem: The key collision problem could be avoided if the unique and arbitrary ke= ys were UUID Many of the other keys should be related to their respective =E2=80=9Ctab= le of truth=E2=80=9D so the migration is dependant on these being the sam= e across the locations The rest TBA down thread :) Regards Gavan Schneider =E2=80=94=E2=80=94 Gavan Schneider, Sodwalls, NSW, Australia Explanations exist; they have existed for all time; there is always a wel= l-known solution to every human problem =E2=80=94 neat, plausible, and wr= ong. =E2=80=94 H. L. Mencken, 1920