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

From Alan Hodgson
Subject Re: Accessing fields in a function that returns a set of composite type - How?
Date
Msg-id 200604181046.25146@hal.medialogik.com
Whole thread Raw
In response to Accessing fields in a function that returns a set of composite type - How?  ("Matt Arnilo S. Baluyos (Mailing Lists)" <matt.baluyos.lists@gmail.com>)
List pgsql-novice
On April 18, 2006 10:37 am, "Matt Arnilo S. Baluyos (Mailing Lists)"
<matt.baluyos.lists@gmail.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

pgsql-novice by date:

Previous
From: "Matt Arnilo S. Baluyos (Mailing Lists)"
Date:
Subject: Re: Accessing fields in a function that returns a set of composite type - How?
Next
From: "Eric Matthew Finnin"
Date:
Subject: Re: The COPY command and csv files