JOINing record returning function to query

From: A Gilmore <agilmore(at)shaw(dot)ca>
To: Postgresql Mailing list <pgsql-novice(at)postgresql(dot)org>
Subject: JOINing record returning function to query
Date: 2005-11-19 17:05:09
Message-ID: 437F5B45.3000709@shaw.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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

Browse pgsql-novice by date

  From Date Subject
Next Message Bill Dika 2005-11-19 22:28:53 Re: Application using PostgreSQL as a back end (experienced programmers please)
Previous Message Andreas Kretschmer 2005-11-19 08:06:08 Re: formating a select from a timestamp column