pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lars Erik Thorsplass <thorsplass@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: [GENERAL] Stored procedures and "pseudo" fields..
Date: Wed, 21 Jul 2004 00:03:32 +0200
Message-ID: <7eeb33a040720150320bf5eed@mail.gmail.com> (raw)
In-Reply-To: <1090338306.709.25.camel@localhost.localdomain>
References: <7eeb33a040720034319e036c6@mail.gmail.com>
	<1090338306.709.25.camel@localhost.localdomain>

On Tue, 20 Jul 2004 09:45:06 -0600, Scott Marlowe <smarlowe@qwest.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



view thread (7+ messages)  latest in thread

Message-ID: <7eeb33a040720150320bf5eed@mail.gmail.com>
Permalink:  ../7eeb33a040720150320bf5eed@mail.gmail.com/
Also on:    postgresql.org/message-id/7eeb33a040720150320bf5eed@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: thorsplass@gmail.com
  Subject: Re: [GENERAL] Stored procedures and "pseudo" fields..
  In-Reply-To: <7eeb33a040720150320bf5eed@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox