Skip site navigation (1) Skip section navigation (2)

Re: managing table partitions automatically

From: Joshua Tolley <eggyknap(at)gmail(dot)com>
To: "Ertel, Steve" <Steve(dot)Ertel(at)infimatic(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: managing table partitions automatically
Date: 2008-11-13 17:20:54
Message-ID: 20081113172054.GH22032@polonium.part.net (view raw or flat)
Thread:
Lists: pgsql-novice
On Thu, Nov 13, 2008 at 10:33:11AM -0600, Ertel, Steve wrote:
> I realize that I could do this from a background process.  The problem
> is that a user may create a record where the start_time is further in
> the future or the past than I have tables to hold it.  The application
> that I am working on contains schedule functionality that allows people
> to schedule events for an unlimited time into the future.
> 
> I could create a TRIGGER or RULE that would be executed for each insert
> that checks for a tables existence, but how do I control the order that
> the rules or triggers are executed in?
> 
> Steve

1) Please avoid top-posting
2) Use triggers instead of rules wherever possible
3) From the docs: "If more than one trigger is defined for the same
event on the same relation, the triggers will be fired in alphabetical
order by trigger name. In the case of before triggers, the
possibly-modified row returned by each trigger becomes the input to the
next trigger. If any before trigger returns NULL, the operation is
abandoned for that row and subsequent triggers are not fired."

- Josh / eggyknap

In response to

Responses

pgsql-novice by date

Next:From: Obe, ReginaDate: 2008-11-13 19:19:24
Subject: Re: managing table partitions automatically
Previous:From: Ertel, SteveDate: 2008-11-13 16:33:11
Subject: Re: managing table partitions automatically

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group