Re: Accessing fields in a function that returns a set of composite type - How?

From: Alan Hodgson <ahodgson(at)simkin(dot)ca>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Accessing fields in a function that returns a set of composite type - How?
Date: 2006-04-18 17:46:25
Message-ID: 200604181046.25146@hal.medialogik.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On April 18, 2006 10:37 am, "Matt Arnilo S. Baluyos (Mailing Lists)"
<matt(dot)baluyos(dot)lists(at)gmail(dot)com> wrote:
> To do a full-text search, I only need to do this:
>
> SELECT search('string');
>
> However, running the function gives me a recordset with only one
> column ("search"). I'd like to be able to access the fields of the
> composite type (search_result) that is returned by the function -
> article_id, article_title, headline, and rank. I haven't figured out
> how to do this but it's necessary because I want to be able to control
> the formatting of the output.
>

In general, a set-returning function looks like a table, ie:

SELECT article_id, article_title, headline, and rank FROM search('string');

Assuming your function works right. I get an error when trying to call a
set-returning function as SELECT function();, though, so I don't know how
yours is doing anything.

--
Alan

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Eric Matthew Finnin 2006-04-18 17:58:34 Re: The COPY command and csv files
Previous Message Matt Arnilo S. Baluyos (Mailing Lists) 2006-04-18 17:45:27 Re: Accessing fields in a function that returns a set of composite type - How?