Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCi98-00076z-UW for pgsql-general@arkaria.postgresql.org; Thu, 18 Feb 2021 12:11:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lCi97-0000s4-Ci for pgsql-general@arkaria.postgresql.org; Thu, 18 Feb 2021 12:11:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lCi97-0000pT-5P for pgsql-general@lists.postgresql.org; Thu, 18 Feb 2021 12:11:01 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lCi92-0007Ls-GK for pgsql-general@lists.postgresql.org; Thu, 18 Feb 2021 12:11:00 +0000 Received: by mail-ej1-x634.google.com with SMTP id ly28so4966719ejb.13 for ; Thu, 18 Feb 2021 04:10:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=RM0+33zEUOO8FSE6I2sm/OIdbrXF/YF+lr/Bxw1hfHs=; b=stOo+8kTgLAlNz5HZF8DEy0CnpICHANYNLprVUtgtxnOL9RQGyMuo8bc/tbcvTcewn zx/ewCl6Dnuac61JH0uW1ze0jRiuwRND42f4KJYlJVdc81X6IWGhwMMBwatVvRyO4QYS eSeWGKk+dVtt4/l7xrnofaikycLFj4uot+ypUeodwUgYPLGaJk/3080Ph6XJ/exnv1Ls Fe5f/gTlc/8CH6K6IFH1cCW1sOyypu3F3I2mkzItYN9BjdD4ZtqIIM2OURSy2ikIqUFW RVfgV2pbZ8GcvolgAPgrFWueEHv5iBsDtgf607nZ86m5Yw0W6LW28/ifSJjerEs+p4EA FvNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=RM0+33zEUOO8FSE6I2sm/OIdbrXF/YF+lr/Bxw1hfHs=; b=qxpAeSQtwUp2we1T6OdU0mlpszCHghBSGbXSOSdbnkrxRY/dM2b3K3dwyoVpXZJ4yO 8KYXKlZyRXW6j81sDht2mNAUsBGsVinTWrE2r8rHE9hCJJI9hY3tcImKYyF1yi2mZ+Dq o5l+E22PHM/dAeSdo+5t/n7aZq4PmGQMDcWYH9NTmt+vtqSqLIAGUyhrCWQwSyP3w+Ji bhp8BQRS8kCldGmrCe+Dc2gs78SXOZ3zy1dEeP0IfCnpXupI1EadjemJEhZQLqI4lb48 oljOI9r/gqXsSm6LN1l6hYZe4iSaLNN2gGWdi2mpktkYqYlvr1SsogPcikh2gpRgpjS5 W03w== X-Gm-Message-State: AOAM5308faaiRX63IvfBqVa1SRQ3DgYAf/HzUGgy/bkeAd6ekFcf/OLp cz4UL58qx/2xvKzKdg0OVnTtfw== X-Google-Smtp-Source: ABdhPJyT2eo6IwRASyQkEcySXEAZzNM8n9qxnjixPShLemf0l05qiNKGNmOxXi8Hgr303twaaTdF5Q== X-Received: by 2002:a17:906:28d6:: with SMTP id p22mr3731940ejd.365.1613650254835; Thu, 18 Feb 2021 04:10:54 -0800 (PST) Received: from localhost.localdomain (217-149-172-130.nat.highway.telekom.at. [217.149.172.130]) by smtp.gmail.com with ESMTPSA id u23sm2636368edt.87.2021.02.18.04.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 04:10:54 -0800 (PST) Message-ID: <472ae18a4dd33ea1447bb5068bcffba6da945be8.camel@cybertec.at> Subject: Re: permanent setting of config variables From: Laurenz Albe To: Joao Miguel Ferreira Cc: pgsql-general Date: Thu, 18 Feb 2021 13:10:53 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, 2021-02-18 at 11:42 +0000, Joao Miguel Ferreira wrote: > On Thu, Feb 18, 2021 at 10:52 AM Laurenz Albe 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