Received: from hotmail.com (f71.law14.hotmail.com [64.4.21.71]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f66IqWa26541 for ; Fri, 6 Jul 2001 14:52:32 -0400 (EDT) (envelope-from oomoomi@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 6 Jul 2001 11:52:30 -0700 Received: from 213.29.16.6 by lw14fd.law14.hotmail.msn.com with HTTP; Fri, 06 Jul 2001 18:52:29 GMT X-Originating-IP: [213.29.16.6] From: "omid omoomi" To: jhudson@forefronthosting.com, pgsql-general@postgresql.org Subject: Re: SELECT'ing a function call Date: Fri, 06 Jul 2001 18:52:29 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 06 Jul 2001 18:52:30.0233 (UTC) FILETIME=[CEF1F890:01C1064C] X-Archive-Number: 200107/186 X-Sequence-Number: 12103 Command: create rule Description: define a new rule Syntax: CREATE RULE rule_name AS ON { SELECT | UPDATE | DELETE | INSERT } TO object [WHERE qual] DO [INSTEAD] [action|NOTHING|[actions]]; HTH Omid >From: "Jared H. Hudson" >To: >Subject: [GENERAL] SELECT'ing a function call >Date: Fri, 6 Jul 2001 12:25:21 -0500 > > >I would like to be able to define a table with 1 column containing user >names, >and the next column being a dynamically generating function that returns a >user's quota. > >I think I see how to create the shared object, and the SQL function. But, >how >do I create a table that uses a function for a column based on the value of >another >column. > >For example, I tried: > >CREATE TABLE test ( > num1 INTEGER, > num2 INTEGER DEFAULT add_one('num1') >); > >But that said that pg_atoi doesn't understand num1 -- so apprenting atoi is >interpreting >num1 as a string, so I tried ...DEFAULT add_one(num1) which gave a >different >error. > >Is this even possible? To have a "trigger" based on a select statement. I >looked at the SQL >TRIGGER command and it seems to only work for INSERT, UPDATE and DELETE. I >need a "trigger" >for SELECT's. > >Thanks, >Jared H. > > >---------------------------(end of broadcast)--------------------------- >TIP 5: Have you checked our extensive FAQ? > >http://www.postgresql.org/users-lounge/docs/faq.html _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.