Re: [GENERAL] join between a table and function.

2011-08-18 Thread Lauri Kajan
Thanks for every one for help. I got it to work. The reason i used a function is that it calculates the values/attributes from several tables in a pretty complex way. I tried to do this by a view first but couldn't do it. I think it's impossible. The function is always supposed to return only one

[GENERAL] join between a table and function.

2011-08-16 Thread Lauri Kajan
Hi all, I have made a function returning a custom record type that contains two fields. Now I want to select from that function. Actually I want to make a join with a table. Let me explain. Here is my function: CREATE TYPE attributes AS (class integer, type integer); CREATE OR REPLACE FUNCTION

Re: [GENERAL] join between a table and function.

2011-08-16 Thread Chetan Suttraway
On Tue, Aug 16, 2011 at 1:11 PM, Lauri Kajan lauri.ka...@gmail.com wrote: Hi all, I have made a function returning a custom record type that contains two fields. Now I want to select from that function. Actually I want to make a join with a table. Let me explain. Here is my function:

Re: [GENERAL] join between a table and function.

2011-08-16 Thread Lauri Kajan
Hi Chetan, I checked out your link but still can't figure it out. How could I pass the parameter to the function from another table. If I try to join or select from the function I'll get an error told that I cannot refer to other relations of same query level. -Lauri On Tue, Aug 16, 2011 at

Re: [GENERAL] join between a table and function.

2011-08-16 Thread Harald Fuchs
In article cakwofmjwz3znxcj9radn4ov+krsa-133968yvag3l8m3w3z...@mail.gmail.com, Lauri Kajan lauri.ka...@gmail.com writes: I have also tried: select *, getAttributes(a.id) from myTable a That works almost. I'll get all the fields from myTable, but only a one field from my function type of

Re: [GENERAL] join between a table and function.

2011-08-16 Thread David Johnston
: Tuesday, August 16, 2011 9:04 AM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] join between a table and function. Hi Chetan, I checked out your link but still can't figure it out. How could I pass the parameter to the function from another table. If I try to join or select from

Re: [GENERAL] join between a table and function.

2011-08-16 Thread Merlin Moncure
On Tue, Aug 16, 2011 at 8:33 AM, Harald Fuchs hari.fu...@gmail.com wrote: In article cakwofmjwz3znxcj9radn4ov+krsa-133968yvag3l8m3w3z...@mail.gmail.com, Lauri Kajan lauri.ka...@gmail.com writes: I have also tried: select *, getAttributes(a.id) from   myTable a That works almost. I'll

Re: [GENERAL] join between a table and function.

2011-08-16 Thread David Johnston
On Aug 16, 2011, at 14:29, Merlin Moncure mmonc...@gmail.com wrote: On Tue, Aug 16, 2011 at 8:33 AM, Harald Fuchs hari.fu...@gmail.com wrote: In article cakwofmjwz3znxcj9radn4ov+krsa-133968yvag3l8m3w3z...@mail.gmail.com, Lauri Kajan lauri.ka...@gmail.com writes: I have also tried: select