X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4478D5E470A for ; Fri, 27 Aug 2004 16:35:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28679-08 for ; Fri, 27 Aug 2004 19:35:46 +0000 (GMT) Received: from web40101.mail.yahoo.com (web40101.mail.yahoo.com [66.218.78.35]) by svr1.postgresql.org (Postfix) with SMTP id 4C34E5E4700 for ; Fri, 27 Aug 2004 16:35:45 -0300 (ADT) Message-ID: <20040827193542.91778.qmail@web40101.mail.yahoo.com> Received: from [130.37.20.20] by web40101.mail.yahoo.com via HTTP; Fri, 27 Aug 2004 12:35:42 PDT Date: Fri, 27 Aug 2004 12:35:42 -0700 (PDT) From: Dino Vliet Subject: Re: help with trigger To: pgsql-general@postgresql.org Cc: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/1463 X-Sequence-Number: 65018 Maybe I've missed it but can someone plese help me with this? Brgds and thanks in advance, --- Dino Vliet 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