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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: 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-08-29 05:02:50
Message-ID: CAFj8pRDtbAj5tLEH3161-xpSqLy5CeUyqKVCyEG8-Szs85ydng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2016-08-29 1:59 GMT+02:00 Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>:

> On 8/26/16 10:32 AM, Alexander Farber wrote:
>
>> Thank you, I was just wondering if there is a simpler way... but ok
>>
>
> 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. It is reason, why exists statement CALL (not
implemented in Postgres) - where these information should not be necessary.

>
> BTW, there's no advantage I can think of to using plpgsql just to return
> the output of a query. You'd be better off using a SQL function instead.
>
> Actually, I guess the plan for the plpgsql version would be cached; I'm
> not sure if the same is true for SQL functions. But you'd probably need a
> more complex query for that to be a win over the lighter weight nature of
> SQL functions.
> --
> Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
> Experts in Analytics, Data Architecture and PostgreSQL
> Data in Trouble? Get it in Treble! http://BlueTreble.com
> 855-TREBLE2 (855-873-2532) mobile: 512-569-9461
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Johannes 2016-08-29 05:14:04 create roles as normal user
Previous Message Jeff Janes 2016-08-29 04:17:38 Re: LOG: could not fork new process for connection: Cannot allocate memory