public inbox for [email protected]
help / color / mirror / Atom feedFrom: David G. Johnston <[email protected]>
To: Ayush Vatsa <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Seeking Clarification on Function Definitions in PostgreSQL Extensions
Date: Wed, 19 Jun 2024 09:50:44 -0700
Message-ID: <CAKFQuwYUBCqsCS85yvHGkvWBtfxUWFJiTQ9MppUNa5RVitD7ew@mail.gmail.com> (raw)
In-Reply-To: <CACX+KaMore7Q-5QUQnTT5R0gKmsa_4jzqn+cmMaSwv6f2KWXCQ@mail.gmail.com>
References: <CACX+KaPBaSW+0PyMC7dmY6W9W8mPSbWpkJRhAOQOC9Qb0TjCQA@mail.gmail.com>
<CAKFQuwbtbhkbw439S3_UbraTpyHfQGxdjjhBBUbfKPd4PVC+xg@mail.gmail.com>
<CACX+KaMore7Q-5QUQnTT5R0gKmsa_4jzqn+cmMaSwv6f2KWXCQ@mail.gmail.com>
On Wednesday, June 19, 2024, Ayush Vatsa <[email protected]> wrote:
> Hi David,
> Thanks for clarification
> > I prefer TABLE. Using setof is more useful when the returned type is
> predefined
> But in the table also isn't the returned type predefined? Example:
> CREATE FUNCTION fun1(integer)
> RETURNS TABLE(
> col1 integer,
> col2 text
> )
> AS 'MODULE_PATHNAME', 'fun1'
> LANGUAGE C;
> We know the returned type will have two columns with type - integer and
> text. Am I correct?
>
Sorry, predefined independently of the function. Using create type then
referring to that type by name in the create function.
>
> > Or a true record where the caller has to specify the shape.
> Sorry but didn't get this shape part?
>
… from rec_func as (col1 isn’t, col2 text) …
The shape is two columns, type int and text respectively.
David J.
view thread (8+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Seeking Clarification on Function Definitions in PostgreSQL Extensions
In-Reply-To: <CAKFQuwYUBCqsCS85yvHGkvWBtfxUWFJiTQ9MppUNa5RVitD7ew@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox