Re: join between a table and function.

From: Harald Fuchs <hari(dot)fuchs(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: join between a table and function.
Date: 2011-08-16 13:33:24
Message-ID: 861uwliiqj.fsf@mgm.protecting.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In article <CAKWoFMJWZ3znXCj9rADn4ov+krsa-133968YvAg3L8M3W3zyQQ(at)mail(dot)gmail(dot)com>,
Lauri Kajan <lauri(dot)kajan(at)gmail(dot)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 attributes.
> myTable.id | myTable.name | getAttributes
> integer | character | attributes
> 123 | "record name" | (10,20)

> What is the right way of doing this?

If you want the attributes parts in extra columns, use

SELECT *, (getAttributes(a.id)).* FROM myTable a

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2011-08-16 13:33:51 Re: join between a table and function.
Previous Message John DeSoi 2011-08-16 13:23:53 Re: [GENERAL] Using Postgresql as application server