referring to computed values from the select list in the where and order clauses - Mailing list pgsql-general

From Stephen Howard
Subject referring to computed values from the select list in the where and order clauses
Date
Msg-id 40428C13.8070804@thunkit.com
Whole thread Raw
Responses Re: referring to computed values from the select list in the where and order clauses
List 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



pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: count(1) return 0?
Next
From: Klint Gore
Date:
Subject: Re: count(1) return 0?