Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJdiE-0060EY-C0 for pgsql-general@arkaria.postgresql.org; Tue, 18 Jun 2024 18:37:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sJdiC-000eSx-45 for pgsql-general@arkaria.postgresql.org; Tue, 18 Jun 2024 18:37:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJdiB-000eSp-Pc for pgsql-general@lists.postgresql.org; Tue, 18 Jun 2024 18:37:44 +0000 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sJdi5-001xJk-Sp for pgsql-general@lists.postgresql.org; Tue, 18 Jun 2024 18:37:43 +0000 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5b96b249d56so43542eaf.1 for ; Tue, 18 Jun 2024 11:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718735857; x=1719340657; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=79neTXCxReXmS2WrLQEC70enEKsQh6CfO62zrMao6MY=; b=df9a6IRbPdYcb4vkfJseTZ5XT8q290XsZKzaJuZ9rDKjWr9IeIEJ7BAlcEVSWgoDZh 8qI8eqz0A/KiBa0Zu641B5dkhMupjdEkguM05JSAURlreYEIS/Hm3L/h4a9rUH3azpuU YO0Z2BFjLB55RuoLT308jkrXQHtJkjFWlbuTaypXC2LeAJD45M+nVQt0p5xM7lZpfOUu AG5pDzYQn/6jdtY+ZNaP2egyejvEO2PoNf5vVs8KCLVPozlYNg1uTND2C4Ml1phK79Vt fGy+CHTajXbVEeW9ZsWf1GcxZL6rHVP4Rx4Tkf6AYRJ6WEvx4uVUsQl0Z9HkPcw45vo2 Y3Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718735857; x=1719340657; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=79neTXCxReXmS2WrLQEC70enEKsQh6CfO62zrMao6MY=; b=M45/tMWSDQzXO+WTc3uAHZrMhm6TWwLvWPZbH75OcoHXkax+zW8QHKtbQqmlnmlWQ8 DDkiJ81fkcikdtsV5KbfmLOrjrC0vV7x0QhGlDHjG+rps7lPiPOjPXn9vLCMlzqo+lpO EgHCFjI6jKkJN15eTDRFPUi3GL1qnGY28q7RJWf0WH1j+MyxwObh+d5jBO6R/LL/zKth wVmGgOfkvIzPZUtKUFkebBZDvazoQnLLcHMd412HZRtNEtMy9ibQaBjK0h9T3CzTFfTW 9J8Q00qU2C+XlDRpgaX0nCk/EXLHfCz/XYg4uQ3rFdxXFvsrFecTg+WU8kHh31u62bng GoaQ== X-Gm-Message-State: AOJu0YxCRhFSh/QL2j4JeXfzKDVDsXtBq9yTVGwmlrYVbNYo16KF/OUZ tVid94PPFe1C6Pg4LagWQ5rExzOEKNtNBqs5B519BJx7hHCc9bCEHJbdGlrobNS2Bv+U2uvs4D2 prUTRFbXsftSSsLC+1KE5H7PqLq2QdQ== X-Google-Smtp-Source: AGHT+IHSax1RlgX3CY/a3tuOU+6KOVYYgwx7kWii/A+M8NT1VL1cVS7kAo3MWnl9Or2yGu1xOqoPRZWYhw0IBulGNfU= X-Received: by 2002:a05:6870:f104:b0:254:b08f:8fcd with SMTP id 586e51a60fabf-25972fb8343mr1467723fac.20.1718735857097; Tue, 18 Jun 2024 11:37:37 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:77c6:0:b0:530:392d:d678 with HTTP; Tue, 18 Jun 2024 11:37:36 -0700 (PDT) In-Reply-To: References: From: "David G. Johnston" Date: Tue, 18 Jun 2024 11:37:36 -0700 Message-ID: Subject: Re: Seeking Clarification on Function Definitions in PostgreSQL Extensions To: Ron Johnson Cc: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="00000000000039a6e7061b2e60e4" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000039a6e7061b2e60e4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tuesday, June 18, 2024, Ron Johnson wrote: > On Tue, Jun 18, 2024 at 1:57=E2=80=AFPM David G. Johnston < > david.g.johnston@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 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=E2=80= =99t change that fact. > > >> Because the out parameters and the =E2=80=9Crecord=E2=80=9D represent th= e exact same >> thing. >> > > 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. David J. --00000000000039a6e7061b2e60e4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tuesday, June 18, 2024, Ron Johnson <ronljohnsonjr@gmail.com> wrote:
On Tue, Jun 18, 2024 at 1:57=E2= =80=AFPM David G. Johnston <david.g.johnston@gmail.com> wrote:
On= Tuesday, June 18, 2024, Ron Johnson <ronljohnsonjr@gmail.com> wrote:

But I stand by returning OUT p= arams and records at the same=C2=A0time.

You mean you dislike adding the optional returns clause whe= n output parameters exist?=C2=A0

Cor= rect.=C2=A0 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 sing= le multi-column output record.=C2=A0 The presence or absence of the optiona= l return clause on a function definition doesn=E2=80=99t change that fact.<= /div>
=C2=A0
=C2=A0
Because the out parameters and the =E2=80=9Crecord=E2=80= =9D represent the exact same thing.
=C2=A0
What's the purpose?=C2=A0 Legacy of not having procedures?=C2=A0
=

So people can have a style gui= de that says always specify a returns clause on function definitions.
=

David J.

=C2=A0
--00000000000039a6e7061b2e60e4--