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 1uuZQC-00Corh-E0 for pgsql-general@arkaria.postgresql.org; Fri, 05 Sep 2025 16:36:21 +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 1uuZQB-008qcJ-G9 for pgsql-general@arkaria.postgresql.org; Fri, 05 Sep 2025 16:36:19 +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 1uuZQB-008qcB-5O for pgsql-general@lists.postgresql.org; Fri, 05 Sep 2025 16:36:19 +0000 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uuZQ9-000i0e-2h for pgsql-general@postgresql.org; Fri, 05 Sep 2025 16:36:18 +0000 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-30ccea94438so1834269fac.2 for ; Fri, 05 Sep 2025 09:36:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757090176; x=1757694976; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=eTV2LwDcWSB9zV9i5gSvUQdHudCP8iwp888yVIZSld0=; b=gSDxgfHnRy/CoggAJvgj45mHMtPtE8kGGfqrRUa4iA1b4RrPX7kL7Z8ZxM6XaiEI4Q vFh2cnZuJ5XYRg3P5gPXT26BoVjFAE3Ia3V04dfYZqDVlzib9606zhp0L5RYVRsSDA23 nqkXeCKyUC0O9zeYNVrj78qHOdtRziA6WlbpnzAJdVNVYianWaehVidcemHukxmU715G R3Ci5Qe1JwSCilwRHVpp9qQ/gqnhmKuTfbTbHu66W6va7dZO7xpDBFwwM/OC1y+Vr5Nu Kjc2Z4gdxyNlI0O2n4Cwwwq2vK7i6cfQ76vyF/UPA3HpfGJEO8jJfq5FncHMpRIvp8XY sdvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757090176; x=1757694976; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eTV2LwDcWSB9zV9i5gSvUQdHudCP8iwp888yVIZSld0=; b=jBDMrWrzJfMfkkzftLiSM0mlE6VZdvDi4fbUTg5e5zsGU7UApF910Wn88P1MXJvbU3 HubWKDp6LSHczzNeSzbijS5fOXD8W7qX0oOLHCxHYYy4WD82/Ofw6kaWwD8sFK6ih3nv HtK2XzxOT/a5verM7ncnSI/RZiVPKqUvp6eiQRAEr/RcYpvX/UOC/EISgWejs9MjpSO7 NWoK9cI1W85RE43pBtm5O+6RBMEQr+/yxVhXSJ/28UOTjqIQ5VCLJj8S4tzQV1cjdgI1 Vif/IV1FAiM/yLQcgHXmUHjhY0g4cYQNuWFmsY73H8DvdxJSwX7JP+vUiDt7sCudO1tN Wx5Q== X-Gm-Message-State: AOJu0YwVZ3c4OH6dVmDwjJOtNHmsUUVHhkwhAHfN3s8waQH3th9os3Eb gutsSYdA+z8Hrr8wTsgfnKeQT80oWZgzevY2qJMzU9fx1u/+yQY7Azu2IZCQhz2msxEfEVW0Lh8 YqLPHthKl5vdIR72uH0ItRPF5q3YpbMIRCA== X-Gm-Gg: ASbGnct89aajGzOFpjM+CNNTzjuum8/T87MQIVB+KfhH8ARsSf4Jci5eGtvOuWWFYGC Mm2zF/Hhd7AHm4Cog2yeXwLEVxz7zZsfeON3CvPeg1ELkjKeEGJ75VF6ZCpwshVfghXH+cAvJYQ 2cQVZrO/56+h1c/iJK796d3+2LY1tddClAFEQC5xc8JTRuwYKVzFxeyyrTQN5ietnJA7Fw2c1XX DXD/KsO X-Google-Smtp-Source: AGHT+IHHKi8eD6s0KyBF/bKhucadYBoIT1Qal8AJT42I9k5C+UC8gW3wUp89cyl6BJI+9urCLrB4KfVhElqRNd/1X1U= X-Received: by 2002:a05:6870:171a:b0:315:b768:bd1d with SMTP id 586e51a60fabf-3196307eeb4mr10740432fac.6.1757090176571; Fri, 05 Sep 2025 09:36:16 -0700 (PDT) MIME-Version: 1.0 References: <1985501673.206991527.1757078030654.JavaMail.zimbra@meteo.fr> In-Reply-To: <1985501673.206991527.1757078030654.JavaMail.zimbra@meteo.fr> From: Ron Johnson Date: Fri, 5 Sep 2025 12:36:05 -0400 X-Gm-Features: Ac12FXy_PI9hH7FZ_ZprlvQRRd4MdKGcWovD-XamxeB_MQ8YLOytSFAe4eVyCYw Message-ID: Subject: Re: PostgreSQL include directive in plpgsql language PL/pgSQL To: pgsql-general Content-Type: multipart/alternative; boundary="000000000000d01f5b063e106fcc" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000d01f5b063e106fcc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Sep 5, 2025 at 9:14=E2=80=AFAM PALAYRET Jacques wrote: > Hello, > > In a PL/pgSQL function, there is no command for sharing a common part of > the body of several functions, is there? > > In my case, I would like a function that returns a numeric value; this > value is associated with several other parameters, some numeric and other= s > textual. > It would not be practical for maintenance to have several functions (one > function for each given parameter) with much of the code being identical. > > Presently, I have a text function with all the parameters in return and a > function for each parameter based on the first one (with all the > parameters), using substr(), position(), etc. > What about something like a "parent" function which a bunch of "stub" functions call? The stub functions would have different parameter types, know what to call the parent function with, and how to return the correct number value. Because of name overloading, they might even have the same name. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000d01f5b063e106fcc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Sep 5, 2025 at 9:14=E2=80=AFAM PA= LAYRET Jacques <jacques.pal= ayret@meteo.fr> wrote:
Hell= o,

In a PL/pgSQL function, there is no command for sharing a common = part of the body of several functions, is there?

In my case, I would= like a function that returns a numeric value; this value is associated wit= h several other parameters, some numeric and others textual.
It would no= t be practical for maintenance to have several functions (one function for = each given parameter) with much of the code being identical.

Present= ly, I have a text function with all the parameters in return and a function= for each parameter based on the first one (with all the parameters), using= substr(), position(), etc.

What about something like a "parent" function which a bunc= h of "stub" functions call?=C2=A0 The stub functions would have d= ifferent parameter types, know what to call the parent function with, and h= ow to return the correct number value.

Because of = name overloading, they might even have the same name.

<= /div>--
Death to <Redacted>, and b= utter sauce.
Don't boil me, I'm still alive.
<R= edacted> lobster!
--000000000000d01f5b063e106fcc--