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

Re: help with trigger

From: Dino Vliet <dino_vliet(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: help with trigger
Date: 2004-08-27 19:35:42
Message-ID: 20040827193542.91778.qmail@web40101.mail.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-sql
Maybe I've missed it but can someone plese help me
with this?

Brgds and thanks in advance,

--- Dino Vliet <dino_vliet(at)yahoo(dot)com> wrote:

> Hi folks,
> I'm new to PostgreSQL and am busy tring to work with
> it. Of pl/pgsql I know even less and that's the part
> I
> have a question on right now. I have this nice
> example
> to get me started with
> pl/pgsql.......
> 
> I have a table with the schedule of a service my
> sport
> team wants to offer:
> 
> Table Schedule
> name       length       startdate     enddate    day
> soccer       4          01-sep-2004  30-sep-2004  
> Mon
> tennis       4          01-sep-2004  30-sep-2004  
> Wed
> 
> This means, that I want to offer soccer weekly, for
> a
> total of 4 weeks as from 1st sep till 30 sep on
> Mondays!
> 
> Now, what I do want is a second table that creates
> all
> the dates on which there will be soccer training if
> I
> finish entering this record in table Schedule. So,
> then the other table, called ScheduledDates has the
> follwing records:
> 
> Table ScheduleDates
> name        occurrence  date
> soccer       1          06-sep-2004
> soccer       2          13-sep-2004
> soccer       3          20-sep-2004
> soccer       4          27-sep-2004
> 
> Can someone help me with writing this as a trigger
> in
> pl/pgsql?
> 
> Another variant is that the trigger starts when the
> table Schedule is populated, but it not just
> automatically creates the 4 records as described
> above, but because the date 20-sep-2004 is a
> national
> holiday and is in table Exceptions, the sheme just
> shifts one up and the occurrence 4 becomes
> occurrence
> 3 and the last schedule date becomes monday the 4th
> of
> october!
> 
> I hope you can help me with this one, will put me
> way
> up the learning curve of pl/pgsql
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

pgsql-sql by date

Next:From: Artimenko IgorDate: 2004-08-27 20:16:14
Subject: Copy command freezes but INSERT works fine with trigger on insert.
Previous:From: Bruno Wolff IIIDate: 2004-08-27 19:20:32
Subject: Re: GRANT ON all tables

pgsql-general by date

Next:From: Vivek KheraDate: 2004-08-27 19:43:25
Subject: Re: How is this possible? (more on deadlocks)
Previous:From: Thomas F.O'ConnellDate: 2004-08-27 19:25:49
Subject: pg_autovacuum start-script

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