Ð ÐÑÑ, 20.07.2004, Ð 15:57, Tomasz Myrta ÐÐÑÐÑ: > 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, <user_id> ) 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, <user_id> ) AS mode FROM objects > WHERE acl_check( objects.obid, <user_id> ) > 0;
and if you properly marked the function STABLE and I am not mistaken, then PostgreSQL is smart enough to execute the function only once per row. -- Markus Bertheau <[EMAIL PROTECTED]> ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly