From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Sathish Kumar <satcse88@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: Triggers when importing data
Date: Thu, 29 Nov 2018 06:50:35 +0100
Message-ID: <cc5125fab95dbbf7f953a719f0ab7c1dc6188c91.camel@cybertec.at> (raw)
In-Reply-To: <CANa_DOhHkGr6HTgYXy5Qq7K1gbVS_c_id_J-BbYFHHNFFhAQag@mail.gmail.com>
References: <CANa_DOhHkGr6HTgYXy5Qq7K1gbVS_c_id_J-BbYFHHNFFhAQag@mail.gmail.com>
Sathish Kumar wrote:
> I am trying to export and import sql file of a database. I would like to know
> whether it will execute all the triggers when importing the sql dump which
> is for Insert or Update or Delete.
>
> Export:pg_dump -h test -U db_admin --format=plain --no-owner --no-acl production | sed -E 's/(DROP|CREATE|COMMENT ON) EXTENSION/-- \1 EXTENSION/g' > test.sql
>
> Import: psql -h test -U db_admin -d production -W < test.sql
That will call all triggers on tables that have no primary key
or unique constraints.
On all other tables, that will give you a constraint violation because
the same rows are already in the table...
What are you trying to achieve?
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.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: laurenz.albe@cybertec.at, satcse88@gmail.com
Subject: Re: Triggers when importing data
In-Reply-To: <cc5125fab95dbbf7f953a719f0ab7c1dc6188c91.camel@cybertec.at>
References: <CANa_DOhHkGr6HTgYXy5Qq7K1gbVS_c_id_J-BbYFHHNFFhAQag@mail.gmail.com> <cc5125fab95dbbf7f953a719f0ab7c1dc6188c91.camel@cybertec.at>
* 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