public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Ron Johnson <[email protected]>
Cc: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re: Seeking Clarification on Function Definitions in PostgreSQL Extensions
Date: Tue, 18 Jun 2024 12:17:06 -0700
Message-ID: <CAKFQuwYFBPmfazee23EXfEG5CK7gxvU8Wu3zE4WEmWMYgjkxpA@mail.gmail.com> (raw)
In-Reply-To: <CANzqJaB_E-wZn3Z91amPN9KCAXfm7JKY08dnuVY2r9mWys-4Bg@mail.gmail.com>
References: <CACX+KaPBaSW+0PyMC7dmY6W9W8mPSbWpkJRhAOQOC9Qb0TjCQA@mail.gmail.com>
	<CANzqJaA-Bmsq5npa1qCaQkDMb-4+9ZqZVUHqpVzURJ-RtSgS-w@mail.gmail.com>
	<CAKFQuwarhk+tg0iJVekT8FENSjhTBXhvVmbep6kWVrUzd1naaA@mail.gmail.com>
	<CANzqJaCWEJb8VXK=063GnE9VF71EAijXf_MCjHj48ooAyUw9bw@mail.gmail.com>
	<CAKFQuwbBAks7=R0GDmSY91YGLp3_kt7nQ3_K_4u38GLz34NbLA@mail.gmail.com>
	<CANzqJaBy1Vwpo_fso+KKo_ubKaaA2etNkz-T5caCexQKQ5m9mg@mail.gmail.com>
	<CAKFQuwa430SdD+fD34_hzCczf9Fv3AKR4Mds_KxPuonaFs7emQ@mail.gmail.com>
	<CANzqJaB_E-wZn3Z91amPN9KCAXfm7JKY08dnuVY2r9mWys-4Bg@mail.gmail.com>

On Tuesday, June 18, 2024, Ron Johnson <[email protected]> wrote:

> On Tue, Jun 18, 2024 at 2:37 PM David G. Johnston <
> [email protected]> wrote:
>
>> On Tuesday, June 18, 2024, Ron Johnson <[email protected]> wrote:
>>
>>> On Tue, Jun 18, 2024 at 1:57 PM David G. Johnston <
>>> [email protected]> wrote:
>>>
>>>> On Tuesday, June 18, 2024, Ron Johnson <[email protected]> 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?
>>>>
>>>
>>> Correct.  It breaks the distinction between function and procedure.
>>>
>>
>> How so?
>>
>> The two distinctions are functions can produce sets while procedures get
>> transaction control.
>>
>> They both can produce a single multi-column output record.  The presence
>> or absence of the optional return clause on a function definition doesn’t
>> change that fact.
>>
>
> "A function returns a value*, but a procedure does not."
>
> *In the case of SQL, "value" might be a set.
>
>
Notably it’s the use of output arguments in create function that violate
the consistency, but using them is the only way to define an adhoc
multi-column result.

I’ll accept the narrow definition of “return value” being something that be
incorporated into an expression.  Procedures do not have that.  Hence they
don;y have a return clause.  Since the output arguments for a function are
return values specifying “returns record” just makes is perfectly clear
what is happening and that it is different than a procedure with the same
output arguments.

David J.


view thread (5+ messages)  latest in thread

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: <CAKFQuwYFBPmfazee23EXfEG5CK7gxvU8Wu3zE4WEmWMYgjkxpA@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