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 1mhnL2-0001Pj-0w for pgsql-admin@arkaria.postgresql.org; Tue, 02 Nov 2021 06:32:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mhnL0-0005Ay-Pr for pgsql-admin@arkaria.postgresql.org; Tue, 02 Nov 2021 06:32:02 +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 1mhnL0-00059x-GM for pgsql-admin@lists.postgresql.org; Tue, 02 Nov 2021 06:32:02 +0000 Received: from carbon.misis.ru ([85.143.104.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mhnKy-0003XK-BO for pgsql-admin@lists.postgresql.org; Tue, 02 Nov 2021 06:32:01 +0000 Received: from mail.tzirechnoy.ru (unknown [10.1.250.11]) by carbon.misis.ru (Postfix) with ESMTP id C5A121FDA1 for ; Tue, 2 Nov 2021 09:31:58 +0300 (MSK) Received: by mail.tzirechnoy.ru (Postfix, from userid 1000) id A264CA42A4; Tue, 2 Nov 2021 09:31:58 +0300 (MSK) Date: Tue, 2 Nov 2021 09:31:58 +0300 From: Ilya Anfimov To: pgsql-admin@lists.postgresql.org Subject: Re: How to control which Python interpreter Postgres uses? Message-ID: <20211102063158.GB1678439@azor.tzirechnoy.ru> Mail-Followup-To: Ilya Anfimov , pgsql-admin@lists.postgresql.org References: <1311504.1635804203@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: C5A121FDA1 X-Rspamd-Server: carbon X-Spamd-Result: default: False [1.00 / 15.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; SUBJECT_ENDS_QUESTION(1.00)[]; RCVD_COUNT_TWO(0.00)[2] List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Nov 01, 2021 at 04:08:01PM -0700, Wells Oliver wrote: > Apologies if I'm misunderstanding, but you can specify a virtual env (so > any interpreter) as we did here: This probably wouldn't allow access to the plpy server access module. Only simplest stored procedures would work without the ability to work with the database (and python version is usually less of importance for such simple scripts). > CREATE FUNCTION slack (msg text) > RETURNS boolean > AS $$ > hook = 'https://...' > activate_this = '/opt/python/env/bin/activate_this.py' > exec(open(activate_this).read(), dict(__file__=activate_this)) > from slack_sdk.webhook import WebhookClient > import ssl > ssl_context = ssl.create_default_context() > ssl_context.check_hostname = False > ssl_context.verify_mode = ssl.CERT_NONE > webhook = WebhookClient(hook, ssl=ssl_context) > webhook.send(text=msg) > return True > $$ LANGUAGE plpython3u; > On Mon, Nov 1, 2021 at 3:06 PM Ni Ne wrote: > > Would I recompile the plpython package or postgres itself? [skipped]