From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Muhammad Bilal Jamil <mbjamil92@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Database trigger (one server to another)
Date: Tue, 31 May 2022 12:20:30 -0700
Message-ID: <0de4339e-b80e-8c32-8a07-7b8f2295f9b0@aklaver.com> (raw)
In-Reply-To: <CAJqS1VKB7pUwapW8VORvAXeknWd8FyTTkBEPMmQSYOXHutYQFQ@mail.gmail.com>
References: <CAJqS1VKB7pUwapW8VORvAXeknWd8FyTTkBEPMmQSYOXHutYQFQ@mail.gmail.com>
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
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: adrian.klaver@aklaver.com, mbjamil92@gmail.com
Subject: Re: Database trigger (one server to another)
In-Reply-To: <0de4339e-b80e-8c32-8a07-7b8f2295f9b0@aklaver.com>
References: <CAJqS1VKB7pUwapW8VORvAXeknWd8FyTTkBEPMmQSYOXHutYQFQ@mail.gmail.com> <0de4339e-b80e-8c32-8a07-7b8f2295f9b0@aklaver.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