Re: permanent setting of config variables

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Joao Miguel Ferreira <joao(dot)miguel(dot)c(dot)ferreira(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: permanent setting of config variables
Date: 2021-02-18 12:10:53
Message-ID: 472ae18a4dd33ea1447bb5068bcffba6da945be8.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2021-02-18 at 11:42 +0000, Joao Miguel Ferreira wrote:
> On Thu, Feb 18, 2021 at 10:52 AM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
> > On Thu, 2021-02-18 at 09:09 +0000, Joao Miguel Ferreira wrote:
> > > I have a few PL/pgSQL functions that use queires like "SHOW company.product INTO _product_name" and "SHOW company.cluster INTO _cluster_number".
> > > But these are failing because I don't know how to set those values on a permanent basis, or maybe on startup would also be ok.
> > > I did read the "ALTER DATABASE " and the "set_config(...)" documentation and I experimented a bit with that but without succes.
> > > So my question would be: how to permanently set user specific config values that would become accessible to the "SHOW ...." SQL comand.
> >
> > _product_name := current_setting('company.product');
> >
>
> I can not change the code in those functions. I need to make them work as they are.

That makes no sense. You say that the statements in your functions are failing.
Then you *have* to change the code.

> So I guess I need to set those variables from an administration action rather than from a coding action.

Your question was about SHOW, not SET, so I have lost you here.

> Something like "ALTER SYSTEM SET company.procut TO 'SpaceCraft';" but this returns
> an error saying "ERROR: unrecognized configuration parameter "company.procut".
> If I'm not mistaken, the "SET ...." command lasts only for the duration of a
> client session. I need it to be permanent.

These parameters do not exist, so you cannot set them permanently.
That's the way it is.

To turn them into parameters, you would have to write a small extension in C
and load it into the server.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2021-02-18 16:05:23 Re: permanent setting of config variables
Previous Message Laurenz Albe 2021-02-18 12:06:50 Re: when is pg_stat_archiver.stats_reset modified?