Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id F02029FB2D8; Thu, 2 Nov 2006 14:14:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 19208-04; Thu, 2 Nov 2006 14:14:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.linuxlouis.net (mx1.linuxlouis.net [70.88.107.105]) by postgresql.org (Postfix) with ESMTP id 3D6FA9FB2E2; Thu, 2 Nov 2006 14:14:23 -0400 (AST) Received: from [192.168.0.3] (wap.linuxlouis.net [70.88.107.106]) (authenticated bits=0) by mx1.linuxlouis.net (8.13.4/8.13.4) with ESMTP id kA2IJXfZ030129 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Nov 2006 13:19:33 -0500 Message-ID: <454A357E.6010409@linuxlouis.net> Date: Thu, 02 Nov 2006 13:14:22 -0500 From: louis gonzales User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "pgsql-general@postgresql.org" CC: pgsql-admin@postgresql.org, "pgsql-sql@postgresql.org" Subject: Is there anyway to... References: <20061102171624.GE21312@localhost> In-Reply-To: <20061102171624.GE21312@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/13 X-Sequence-Number: 23540 Hello all, Is there an existing mechanism is postgresql that can automatically increment/decrement on a daily basis w/out user interaction? The use case I'm considering is where a student is in some type of contract with an instructor of some sort, and that contract puts a time limit on the student requiring her to pay a fee by a certain day. IF that day comes to pass - or a certain number of days elapse - and that payment requirement hasn't been met, I want to trigger a function. The one requirement I want to impose is, that no end user of the DB application, needs to do anything to set the trigger, other than the initialization of making the student of this type. An example would be: Day1 - Application user(typically the instructor) creates a profile for a new student - John Doe, which sets a 30 day time limit for John Doe to pay $100.00 Day2 -> Day31 - John Doe didn't make the payment Day 31 - Trigger of event occurs when the instructor logs in. Basically on Day 1 when John Doe's profile was created, I want a decrement counter to occur daily on his profile(some attribute/timer) and nothing should happen until day 31 when he doesn't pay. Any ideas? -- Email: louis.gonzales@linuxlouis.net WebSite: http://www.linuxlouis.net "Open the pod bay doors HAL!" -2001: A Space Odyssey "Good morning starshine, the Earth says hello." -Willy Wonka