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 1nw7Q1-0005jx-SW for pgsql-general@arkaria.postgresql.org; Tue, 31 May 2022 19:20:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nw7Q0-0005Bq-OX for pgsql-general@arkaria.postgresql.org; Tue, 31 May 2022 19:20:40 +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 1nw7Pz-0005Bh-If for pgsql-general@lists.postgresql.org; Tue, 31 May 2022 19:20:40 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nw7Pu-0001z9-A0 for pgsql-general@lists.postgresql.org; Tue, 31 May 2022 19:20:38 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id DF80F3200A26; Tue, 31 May 2022 15:20:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 31 May 2022 15:20:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1654024832; x= 1654111232; bh=0L3ARCL8q+pIIb/nNtMOWAyzXTJ/Azmmd3q7a6FRCh0=; b=r zSizL0wE/9kyK/WelB3D9+gK/UGDmStb+S9jH/eB5kWqZW+C+GTKuT7XEkmGstRw 3VQ/6ywfU2pwXHlh2kkguv53Y5XxZDgxO87uNZFp+5lkzkE5kDrUFvPb5aM/IMv/ I0GUmU6Tkb45aG3WqFYMoNAb2b1LwLAuX23jGJjrWpwzUxuJ3rR02ooBR/jQ82gf bLz+lV2556L9Ff1H6gwvUnDF0C61mr1W+ElMheK1xmNJOQ4YihJOj9A+HRwKEUHO pbbRFkQzqPjFmMJnzuInRTKooQ1wWWSlNft+TMdQj3GL8sgSZRVEE4yMshNQGTOb g5iJdaR4MZX9bVE6Zoc7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1654024832; x=1654111232; bh=0 L3ARCL8q+pIIb/nNtMOWAyzXTJ/Azmmd3q7a6FRCh0=; b=yhZe8O90TE3heDAVS OWHeUqm2O73LGKLhaHzIGxTSvn1NNTJGu7Hdmkqix4SKuFWlgKXick4SYm3s/Pg5 7FJoqOqEST7jnrxoKCQQRBTi/1U+vTgb7k6yeTcllLerc96mOvr3RsUTgvyg7uzA 9ZSUvkqsqdIq1oIzPbKhOhWJHDMA3IDEjQnZ9x+xB1kGawNHNhmiSx57XCwylE+k ahUca/kpyeqj2Hmr34+DxrNdAtQW+tMpaXYbXdNOkmfbq+Du9AxxEkQa14P1TQCQ FF/BJUv2JKdQyybOLKxFlGN3SRsCL+50NyCCJdadu+K2smRoJ7o8RRNc20pvbiwF U5ZcQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrkeekgddufeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeevteejtdeikeetfefhhffhteelvdekffevudegjeeu kefhgfdvieeliedtkeevhfenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhi rghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 31 May 2022 15:20:31 -0400 (EDT) Subject: Re: Database trigger (one server to another) To: Muhammad Bilal Jamil , pgsql-general@lists.postgresql.org References: From: Adrian Klaver Message-ID: <0de4339e-b80e-8c32-8a07-7b8f2295f9b0@aklaver.com> Date: Tue, 31 May 2022 12:20:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/31/22 11:59 AM, Muhammad Bilal Jamil wrote: > Hi fellow database engineers, > > I am currently on a project where i have read only access to a > production system (replicated) from where i want to copy data into > another schema. Ideally what i want to do is that if for an event > happens in the replicated schema (server#1) like something updates, then > my database trigger runs and copies data from server#1 to my 2nd schema > (server#2) for which i have read/write rights. > > Is this something possible? I would create the trigger in the 2nd server > obviously since for first one i cant write anything. You might try postgres_fdw: https://www.postgresql.org/docs/current/postgres-fdw.html Set up a table in the second server that links to the other server. Then you have access to the data on the second server. > > Best > Bilal -- Adrian Klaver adrian.klaver@aklaver.com