Re: plpgsql functions organisation

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>, Yves Dorfsman <yves(at)zioup(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: plpgsql functions organisation
Date: 2015-05-02 20:05:02
Message-ID: 55452DEE.1070701@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 05/02/2015 10:12 AM, Melvin Davidson wrote:
> AFAIK, you cannot "package" functions in PostgreSQL, but it is possible to
> call a function from within a function.
>
> That being said, I would seriously look at how and why you are writing
> your functions
> as functions that call other functions are not very efficient.

I am not following. That is what packaging is about, separating out
'units of work' so they can be combined as needed. Part of that is using
existing functions in new functions/classes. In fact in the Postgres
source I see this in many places. Now it is entirely possible I missed a
memo, so I am open to a more detailed explanation of the inefficiencies
involved.

>
> Also note that PostgreSQL allows you define functions using Python, so
> that might be a possible compromise.
>
> On Sat, May 2, 2015 at 12:53 PM, Yves Dorfsman <yves(at)zioup(dot)com
> <mailto:yves(at)zioup(dot)com>> wrote:
>
>
> I find my plpgsql functions becomes unreadable very quickly. I want
> to break
> them up in smaller functions.
>
> What is the best way to organised them?
> Is there any way to define functions inside functions?
> When I list functions in psql, I can see them all at the same level,
> is there
> any way to organise them in packages like with python and other
> languages, so
> the smaller functions are hidden away in a package/directory?
>
>
> Thanks.
>
> --
> http://yves.zioup.com
> gpg: 4096R/32B0F416
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org
> <mailto:pgsql-general(at)postgresql(dot)org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
>
>
>
> --
> *Melvin Davidson*
> I reserve the right to fantasize. Whether or not you
> wish to share my fantasy is entirely up to you.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2015-05-02 21:07:31 Re: plpgsql functions organisation
Previous Message Yves Dorfsman 2015-05-02 19:34:29 Re: plpgsql functions organisation