referring to computed values from the select list in the where and order clauses

From: Stephen Howard <stephen(at)thunkit(dot)com>
To: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: referring to computed values from the select list in the where and order clauses
Date: 2004-03-01 01:04:19
Message-ID: 40428C13.8070804@thunkit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've got a moderately complex function defined which i then want to be

able to test the value of, as well as select the value:

select id, vector_cosine(document,'[ qw( foo,bar,baz )]') as threshold
from search_vectorspace where threshold > 0 order by threshold desc;

I've tried it both with and without an AS alias, but in both instances
pgsql complains that the column does not exist. I would like to be able
to use the value computed with out having to recompute it every place i
wish to use the value. I've not had much luck finding this information
in the Postgres documentation. Anyone know what syntax i should be using?

thanks,
Stephen

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Klint Gore 2004-03-01 01:13:07 Re: count(1) return 0?
Previous Message Bill Moran 2004-03-01 01:02:40 Re: count(1) return 0?