X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E7425D1B298 for ; Tue, 20 Jul 2004 10:56:13 -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 12407-01 for ; Tue, 20 Jul 2004 13:56:11 +0000 (GMT) Received: from serwer.skawsoft.com.pl (rtr.skawsoft.com.pl [213.25.37.67]) by svr1.postgresql.org (Postfix) with ESMTP id 2894FD1B23E for ; Tue, 20 Jul 2004 10:56:04 -0300 (ADT) Received: from [192.168.24.1] (unknown [80.51.253.210]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id E34562B3CD; Tue, 20 Jul 2004 15:55:47 +0200 (CEST) Message-ID: <40FD24D1.1090005@klaster.net> Date: Tue, 20 Jul 2004 15:57:37 +0200 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.7) Gecko/20040514 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Lars Erik Thorsplass Cc: pgsql-sql@postgresql.org Subject: Re: Stored procedures and "pseudo" fields.. References: <7eeb33a040720034319e036c6@mail.gmail.com> <7eeb33a04072006342b5d35a0@mail.gmail.com> In-Reply-To: <7eeb33a04072006342b5d35a0@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: 200407/126 X-Sequence-Number: 18378 On 2004-07-20 15:34, Użytkownik Lars Erik Thorsplass napisał: > My stored procedure "acl_check()" takes two integers as parameters. > Param1 is the object id to check acl on, Param 2 is the object id of > the user currently using the system. The procedure returns a positive > number (1 or 3 ) if you have some kind of access to the object. As one > might understand I want the returned value from the acl_check() > procedure to be a part of the result set. > > Kinda like this: > > SELECT *, acl_check( objects.obid, ) AS mode FROM objects > WHERE mode > 0; > > This gives me a: ERROR: column "mode" does not exist You can't access column output alias in where clause. Instead you have to use your function twice: SELECT *, acl_check( objects.obid, ) AS mode FROM objects WHERE acl_check( objects.obid, ) > 0; Regards, Tomasz Myrta