Re: a column definition list is required for functions returning "record"

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Alexander Farber <alexander(dot)farber(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: a column definition list is required for functions returning "record"
Date: 2016-09-07 19:02:54
Message-ID: CAHyXU0wGsBySM=-fVDxz7pNGRa6L7a3Bzngzo5Jbk3bc+sVKhg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Fri, Sep 2, 2016 at 6:55 PM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> wrote:
> On 8/29/16 6:28 AM, Tom Lane wrote:
>>
>> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>>>
>>> > 2016-08-29 1:59 GMT+02:00 Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>:
>>>>
>>>> >> It would be nice if there was a way to pass dynamically formed
>>>> >> records
>>>> >> around, similar to how you can pass the results of row() around.
>>>> >> Someone
>>>> >> else has actually be asking about this at
>>>> >> https://github.com/decibel/pg_
>>>> >> lambda/issues/1.
>>>
>>> > Probably there is a space to be PLpgSQL more flexible - but there are
>>> > limits - PLpgSQL is black box for SQL engine, and when output is any
>>> > record
>>> > type, then SQL engine knows zero about returning data structure in
>>> > preprocessing time.
>>
>> Exactly. You can pass anonymous record types around today, as long as you
>> don't do anything that requires knowing what their contents are, either in
>> the function or in the calling query:
>
> What I was thinking of is something (like a function) that has explicitly
> defined what the contents of the record are.

We have that already, it's named 'json_each_text' :-).

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-09-07 19:23:47 Re: pgAdmin 4 records limit of 2000
Previous Message Naveed Shaikh 2016-09-07 17:10:57 Re: PostgreSQL Database performance