Re: Partitioned tables and triggers

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Partitioned tables and triggers
Date: 2012-04-06 07:48:07
Message-ID: 20120406074807.GA4799@tux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

mephysto <mephystoonhell(at)gmail(dot)com> wrote:

> Hello to everyone, yesterday I created my first montly partitioned table with
> its insert trigger following the specific manual page.
>
> At the moment table seems to work correctly, but I have some doubts:
>
> 1 - After an insert operation, I can see data either in master and in child
> table. Is this a normal behavior?

Yeah, but you can say 'select ... from ONLY ...'

> 2 - I created only insert trigger, but not update and delete. Do I need also
> these triggers to managing data correctly?

Depends. Is this a insert-only - table, or do you have updates/deletes?

> 3 - When a BEFORE INSERT trigger function execute in its turn an INSERT
> operation, are the origina INSERT executed or not? Are the data inserted in
> master table also, and not only in child table?

Your INSERT-Function should return NULL to avoid insert into the
main-table.

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message mephysto 2012-04-06 08:06:12 Re: Partitioned tables and triggers
Previous Message mephysto 2012-04-06 06:56:20 Partitioned tables and triggers