On Wednesday, June 19, 2024, Ayush Vatsa 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(
>
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
"David G. Johnston" writes:
> On Tuesday, June 18, 2024, Ron Johnson wrote:
>> What's the purpose? Legacy of not having procedures?
> So people can have a style guide that says always specify a returns clause
> on function definitions.
To my mind, the reason we allow RETURNS together with OUT
On Tuesday, June 18, 2024, Ron Johnson wrote:
> On Tue, Jun 18, 2024 at 2:37 PM David G. Johnston <
> david.g.johns...@gmail.com> wrote:
>
>> On Tuesday, June 18, 2024, Ron Johnson wrote:
>>
>>> On Tue, Jun 18, 2024 at 1:57 PM David G. Johnston <
>>> david.g.johns...@gmail.com> wrote:
>>>
O
On Tue, Jun 18, 2024 at 2:37 PM David G. Johnston <
david.g.johns...@gmail.com> wrote:
> On Tuesday, June 18, 2024, Ron Johnson wrote:
>
>> On Tue, Jun 18, 2024 at 1:57 PM David G. Johnston <
>> david.g.johns...@gmail.com> wrote:
>>
>>> On Tuesday, June 18, 2024, Ron Johnson wrote:
>>>
On Tuesday, June 18, 2024, Ron Johnson wrote:
> On Tue, Jun 18, 2024 at 1:57 PM David G. Johnston <
> david.g.johns...@gmail.com> wrote:
>
>> On Tuesday, June 18, 2024, Ron Johnson wrote:
>>
>>>
>>> But I stand by returning OUT params and records at the same time.
>>>
>>
>> You mean you dislike
On Tue, Jun 18, 2024 at 1:57 PM David G. Johnston <
david.g.johns...@gmail.com> wrote:
> On Tuesday, June 18, 2024, Ron Johnson wrote:
>
>>
>> But I stand by returning OUT params and records at the same time.
>>
>
> You mean you dislike adding the optional returns clause when output
> parameters
On Tuesday, June 18, 2024, Ron Johnson wrote:
>
> But I stand by returning OUT params and records at the same time.
>
You mean you dislike adding the optional returns clause when output
parameters exist? Because the out parameters and the “record” represent
the exact same thing.
David J.
On Tue, Jun 18, 2024 at 1:16 PM David G. Johnston <
david.g.johns...@gmail.com> wrote:
> On Tue, Jun 18, 2024 at 10:07 AM Ron Johnson
> wrote:
>
>> fun2 puzzles me. Why would you return parameters AND *a single record*
>> (unless
>> it's an error status).
>>
>
> You mis-understand what 2 is doi
On Tue, Jun 18, 2024 at 10:07 AM Ron Johnson
wrote:
> fun2 puzzles me. Why would you return parameters AND *a single record*
> (unless
> it's an error status).
>
You mis-understand what 2 is doing. You should go re-read the docs for
create function again. Especially the description of rettyp
On Tue, Jun 18, 2024 at 9:50 AM Ayush Vatsa
wrote:
> 1/ I wanted to know what's the difference between the above three
> definitions.
> As per my understanding, "fun1" and "fun2" look the same, taking one
> integer and returning two columns with multiple rows.
>
Yes.
>
> Can the above definiti
fun1 returns a table set just like any other SELECT statement.
fun2 puzzles me. Why would you return parameters AND *a single record* (unless
it's an error status).
fun3 just returns two parameters. Why isn't it a procedure?
fun2, returning parameters AND a function value, would have made my Com
Hi PostgreSQL community,
Recently I am exploring extensions in postgres and got a little confused
regarding the function definition present in SQL file. For example consider
below three functions:
CREATE FUNCTION fun1(integer)
RETURNS TABLE(
col1 integer,
col2 text
)
AS 'MODULE_PAT
13 matches
Mail list logo