Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8AB969FB2A7 for ; Thu, 2 Nov 2006 15:55:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 31534-02 for ; Thu, 2 Nov 2006 15:55:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from hs5.cfa.cmu.edu (HS5.CFA.cmu.edu [128.2.103.215]) by postgresql.org (Postfix) with ESMTP id F1B6E9FB21E for ; Thu, 2 Nov 2006 15:55:52 -0400 (AST) Received: from [192.168.100.102] (host82.155.212.198.conversent.net [155.212.198.82]) (authenticated bits=0) by hs5.cfa.cmu.edu (8.12.11.20060308/8.12.11) with ESMTP id kA2JtpoR019844 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO) for ; Thu, 2 Nov 2006 14:55:52 -0500 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <8ABD7C06-79D9-44F6-B21B-7C4F8E0FCB3B@themactionfaction.com> Content-Transfer-Encoding: 7bit From: AgentM Subject: Re: Is there anyway to... Date: Thu, 2 Nov 2006 14:55:50 -0500 To: pgsql general X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/121 X-Sequence-Number: 103217 On Nov 2, 2006, at 15:00 , Richard Troy wrote: > > > On Thu, 2 Nov 2006, AgentM wrote: >>> >>> Just some commentary... This is exactly the sort of thing cron is >>> for. Duplicating that functionality in the RDBMS would be silly >>> IMO. I don't see why you could consider cron to be "dirty" for >>> this application... >> >> I actually tried to come up with something for this. There are plenty >> of good reasons to have some timer functionality in the database: >> >> 1) it makes regular database-oriented tasks OS portable >> 2) your cron user needs specific permissions + authorization to >> access the database whereas postgres could handle "sudo"-like >> behavior transparently >> 3) there are triggers other than time that could be handy- on vacuum, >> on db start, on db quit, on NOTIFY >> >> Unfortunately, the limitation I came across was for 2). There is no >> way to use "set session authorization" or "set role" safely because >> the wrapped code could always exit from the sandbox. So my timer only >> works for db superusers. >> >> -M > > ...This type of need is exactly what custom written daemons are for. > They're surely database and OS portable (or can be, at least), > there's no > need for any super-user capability of any kind, you can use any > kind of > trigger you like, and there's no permission leakage problem, > either... I > guess all you need is functioning nohup capability (which Windows > systems > may have trouble with, I don't know). Sure- I wrote a custom daemon. But it has general usefulness. Instead of ten clients listening on ten notifications (and holding open connections for little reason), I would like to have one connection handle all the notification events- based on which notification or timer event, it could call a different stored procedure with different roles. That way, I wouldn't need one connection open for ever user that needs to listen and react. That simply doesn't scale. Cheers, M