Received: from mail1.forefronthosting.com (mail1.forefronthosting.com [65.65.33.4]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f66HPMa81583 for ; Fri, 6 Jul 2001 13:25:22 -0400 (EDT) (envelope-from jhudson@forefronthosting.com) Received: from albert (albert.localdomain [10.1.0.9]) by mail1.forefronthosting.com (8.11.0/8.8.7) with SMTP id f66HQXD19680 for ; Fri, 6 Jul 2001 12:26:33 -0500 From: "Jared H. Hudson" To: Subject: SELECT'ing a function call Date: Fri, 6 Jul 2001 12:25:21 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2479.0005 Importance: Normal X-Archive-Number: 200107/180 X-Sequence-Number: 12097 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.