pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Durumdara <durumdara@gmail.com>
Cc: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Restore - disable triggers - when they fired?
Date: Wed, 21 Mar 2018 06:16:34 -0700
Message-ID: <8b75c8bb-e5a5-47eb-0cc6-477a90a8a7cc@aklaver.com> (raw)
In-Reply-To: <CAEcMXhnx1xLh0k-VvY=4TGNiidgdTUUBsB=E-JLf3cVA4Tep+w@mail.gmail.com>
References: <CAEcMXhnt9P=4E7syOurQPgZgnH9XKUU+EoWkx+Vf0W_Q=7-W+g@mail.gmail.com>
	<b98fbad7-2080-603c-5c8b-be95407b5996@aklaver.com>
	<CAEcMXhnYkiVmcKBVzmrQTe-ukb7cxz=cK2nbnY26A=Ywn2p6ng@mail.gmail.com>
	<cdd36500-2d8c-2352-4f1f-b63a024dce15@aklaver.com>
	<CAEcMXhnx1xLh0k-VvY=4TGNiidgdTUUBsB=E-JLf3cVA4Tep+w@mail.gmail.com>

On 03/21/2018 02:41 AM, Durumdara wrote:
> Dear Adrian!
> 
> 2018-03-20 16:33 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com 
> <mailto:adrian.klaver@aklaver.com>>:
> 
>     On 03/20/2018 07:56 AM, Durumdara wrote:
> 
> 
>     pg_dump --disable-triggers -d test -U aklaver -t
>     disable_trigger_test -a -f disable_trigger_test_data.sql
> 
> 
>     CREATE OR REPLACE FUNCTION public.trigger_test()
>     ...
>     truncate disable_trigger_test ;
> 
>     #Note I do this as a superuser.
>     psql -d test -U postgres -f disable_trigger_test_data.sql
> 
>     test=> select * from disable_trigger_test ;
>       id | fld_1
>     ----+-------
>        1 | dog
>        2 | cat
> 
> 
> Thank you! Now I got it!
> So the difference is:
> 
> 1.) FULL DB restore into empty database creates the extra objects at the 
> end, so I do not need to worry about triggers.

This also holds if you do a single(or multiple) table restore of both 
the table schema and data at the same time.

> 
> 2.) Partial data restore into an existing database to existing tables 
> with triggers: this point I need to set "disable triggers" option.

Well partial or complete data restore, anything that will trip the 
triggers on an existing table.


> Very-very thank you!

Glad it helped.

> 
> dd


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (6+ messages)

Message-ID: <8b75c8bb-e5a5-47eb-0cc6-477a90a8a7cc@aklaver.com>
Permalink:  ../8b75c8bb-e5a5-47eb-0cc6-477a90a8a7cc@aklaver.com/
Also on:    postgresql.org/message-id/8b75c8bb-e5a5-47eb-0cc6-477a90a8a7cc@aklaver.com

 · 

reply

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, durumdara@gmail.com
  Subject: Re: Restore - disable triggers - when they fired?
  In-Reply-To: <8b75c8bb-e5a5-47eb-0cc6-477a90a8a7cc@aklaver.com>
  References: <CAEcMXhnt9P=4E7syOurQPgZgnH9XKUU+EoWkx+Vf0W_Q=7-W+g@mail.gmail.com> <b98fbad7-2080-603c-5c8b-be95407b5996@aklaver.com> <CAEcMXhnYkiVmcKBVzmrQTe-ukb7cxz=cK2nbnY26A=Ywn2p6ng@mail.gmail.com> <cdd36500-2d8c-2352-4f1f-b63a024dce15@aklaver.com> <CAEcMXhnx1xLh0k-VvY=4TGNiidgdTUUBsB=E-JLf3cVA4Tep+w@mail.gmail.com> <8b75c8bb-e5a5-47eb-0cc6-477a90a8a7cc@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