From: | Kevin Murphy <murphy(at)genome(dot)chop(dot)edu> |
---|---|
To: | PostgreSQL general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: function accepting and returning rows; how to avoid |
Date: | 2006-12-13 17:36:38 |
Message-ID: | 45803A26.3040401@genome.chop.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Merlin Moncure wrote:
> On 12/13/06, Kevin Murphy <murphy(at)genome(dot)chop(dot)edu> wrote:
>> I'd like to have a function that acts as a row filter (that can
>> optionally expand each row into multiple rows), but I don't know how to
>> wangle this such that the output is not enclosed in parentheses, i.e.
>> what I'm getting now is a single column of a composite type instead of
>> multiple columns matching the original table layout.
>
> functions defined in the sql language (as opposed to pl/pgsql) allow
> you to call them without explicitly using from...if you want to
> expand, just select from your result as you would expand any row
> variable. basically, have you tried:
>
> select (explode(sometable.*)).* from sometable;
>
Thanks a lot. You must have been puzzled that I got so close and failed
to figure it out. I hadn't really understood the {row}.* notation. In
the meantime I did an end run with an insert trigger, but at least I
understand this now.
-Kevin
From | Date | Subject | |
---|---|---|---|
Next Message | Rafal Pietrak | 2006-12-13 17:37:59 | about the RULE system |
Previous Message | Tony Caduto | 2006-12-13 17:36:03 | Re: Weird PG 8.1.3 date error |