[GENERAL] Shared Constants in PLPGSQL - Mailing list pgsql-general

From Tim Uckun
Subject [GENERAL] Shared Constants in PLPGSQL
Date
Msg-id CAGuHJrNipwCVQx5RYLjdF5CEk_cgeSMimZ_aGwk_5B2_wEOusg@mail.gmail.com
Whole thread Raw
Responses Re: [GENERAL] Shared Constants in PLPGSQL  ("btober@computer.org" <btober@broadstripe.net>)
Re: [GENERAL] Shared Constants in PLPGSQL  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general
What's the best way to deal with global constants in PLPGSQL. Currently I am putting them in a function with out parameters and then calling that function from every other function that needs them like this.

CREATE OR REPLACE FUNCTION hashids.constants(
     OUT min_alphabet_length integer, 
    OUT sep_div numeric, 
    OUT guard_div numeric, 
    OUT default_steps text, 
    OUT default_alphabet text, 
    OUT salt text)

I am presuming that if I set this function as immutable the calls to this function will be cached and will not incur much overhead.

Is there a better way to deal with this?

pgsql-general by date:

Previous
From: Murtuza Zabuawala
Date:
Subject: [GENERAL] Not able to create collation on Windows
Next
From: "btober@computer.org"
Date:
Subject: Re: [GENERAL] Shared Constants in PLPGSQL