From: | Ron Johnson <ronljohnsonjr(at)gmail(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: PostgreSQL include directive in plpgsql language PL/pgSQL |
Date: | 2025-09-05 16:36:05 |
Message-ID: | CANzqJaDiiu9Qy7e=TsLqqU9KCJSXWJQngoS5cVX2up4b-P7Bkw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Sep 5, 2025 at 9:14 AM PALAYRET Jacques <jacques(dot)palayret(at)meteo(dot)fr>
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 others
> 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.
--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
From | Date | Subject | |
---|---|---|---|
Next Message | Alec Cozens | 2025-09-05 17:02:27 | LWLock SerializableFinishedList |
Previous Message | Merlin Moncure | 2025-09-05 16:21:08 | Re: PostgreSQL include directive in plpgsql language PL/pgSQL |