Re: [GENERAL] Stored procedures and "pseudo" fields..

From: Lars Erik Thorsplass <thorsplass(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: [GENERAL] Stored procedures and "pseudo" fields..
Date: 2004-07-20 22:03:32
Message-ID: 7eeb33a040720150320bf5eed@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On Tue, 20 Jul 2004 09:45:06 -0600, Scott Marlowe <smarlowe(at)qwest(dot)net> wrote:
> > Kinda like this:
> >
> > SELECT *, acl_check( objects.obid, <user_id> ) AS mode FROM objects
> > WHERE mode > 0;
>
> Here's the problem. In order to do the select, the query first needs to
> run the where clause. I.e.:
>
> select a as test from table where a > 50;
>
> works, but
>
> select a as test from table where test > 50;
>
> fails. The reason is that when the where clause fires first, there IS
> no test yet, as it hasn't been materialized. what you need to do is:
>
> select custom_function(a,b) from table where custom_function(a,b) > 0;
>
>

Thanks for clearing that up. I just hoped there was some magic I could
sprinkle on my query to get away from the extra overhead of running
the procedure twice :)

Best regards..

L.E.Thorsplass

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc G. Fournier 2004-07-21 02:17:11 Re: mail-news server down
Previous Message Lee Harr 2004-07-20 21:45:27 mail-news server down

Browse pgsql-sql by date

  From Date Subject
Next Message azah azah 2004-07-21 00:55:03 date_format in postresql
Previous Message Steve Crawford 2004-07-20 18:30:19 Re: locks and triggers. give me an advice please