JOINing record returning function to query

Поиск
Список
Период
Сортировка
Искать

JOINing record returning function to query

От:
A Gilmore <agilmore@shaw.ca>
Дата:
Hello,

I have a plpgsql function that returns a single row based on two ints it 
is passed.  I want to join this function onto a SELECT query.  If I give 
it to static ints like :

myfunc(8, 5);

It works fine, however in the query, the second arg is a column like so:

myfunc(7, t1.id);

This results in the error :

NOTICE:  adding missing FROM-clause entry for table "t1"
ERROR:  function expression in FROM may not refer to other relations of 
same query level

What is the proper method of doing this?  Google found this discussion 
(http://www.issociate.de/board/post/130018/function_expression_in_FROM_may_not_refer_to_other_relations_of_same_query_level.html) 
but after reading a few times I am still scratching my head.

Example code would probably be to lengthy to be useful.

Thank you in advance,
- A Gilmore
FAQ