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 1jgXpM-0003tV-Ke for pljava-dev@arkaria.postgresql.org; Wed, 03 Jun 2020 18:09:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jgXpK-0001PJ-O5 for pljava-dev@arkaria.postgresql.org; Wed, 03 Jun 2020 18:09:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgXpK-0001PC-7Q for pljava-dev@lists.postgresql.org; Wed, 03 Jun 2020 18:09:22 +0000 Received: from anastigmatix.net ([68.171.219.55]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgXpH-00032o-47 for pljava-dev@lists.postgresql.org; Wed, 03 Jun 2020 18:09:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kNj3J3zQ45FfaDa/h+eaRgPpZhtceZBmISQ4meI4rNI=; b=Lbl6oKI7mjutWU8A2DR29hG0D2 3DruANmy8q0UwhCwNFQ2gDQwCe5h12NlTEkoFzqXlZCsNw8otZY6CvhqBmY1V6eAgFzRmlBCh3m7r 2IKBtlz52+ZfldAFnGL78ln2xsite7Afw8QOIs/rHPpAV2i/O5sj03kV3eQgdG723+MxkNSSPsHhG bYenwaNJawftYev/1kz2dzrmVBwzt+1eYk2QdfFpVnHGNztifib0Yd/YNKseo6Ay09z3CnkPuordt SNzjXAXetDkBDrmyjdaa+AQIyiROmEHd9ETqI2X//Ub534nQnDkAMKbIWgmXTcm1yduw3vuBiuP00 QimpGiaQ==; Received: from [184.19.31.139] (port=60638) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1jgXpD-009mSP-Pp; Wed, 03 Jun 2020 14:09:16 -0400 Subject: Re: Starting build-system work (Windows/Mac users please speak up) To: Kartik Ohri References: <5EC17E17.7070002@anastigmatix.net> <5ECED046.3000308@anastigmatix.net> <5ED0FCB0.405@anastigmatix.net> <5ED10C6D.2020000@anastigmatix.net> <5ED10F36.7060304@anastigmatix.net> <5ED15825.9060504@anastigmatix.net> <5ED270BA.9010001@anastigmatix.net> <5ED3D488.1010401@anastigmatix.net> <5ED474CA.3000106@anastigmatix.net> <5ED4EA10.4030801@anastigmatix.net> Cc: pljava-dev@lists.postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5ED7E74B.9020800@anastigmatix.net> Date: Wed, 3 Jun 2020 14:09:15 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-95.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 06/03/20 13:24, Kartik Ohri wrote: > ERROR: ALTER SYSTEM cannot run inside a > transaction bloc at psql -c "SET pljava.libjvm_location to '$libjvm'; ALTER > SYSTEM SET pljava.libjvm_location to '$libjvm'; SELECT pg_reload-conf();" > -U postgres . Hmm. psql does have a --single-transaction mode that, if enabled, makes psql send a BEGIN before your first command and a COMMIT after the last one, so that if you have multiple commands, they all happen in one transaction. [1] If one of your commands is something that's not allowed inside a transaction block, that of course will be a problem. What surprises me is that you see this happening on Windows only. I wonder if psql is built with different option defaults there? Or could there be a .psqlrc (or whatever it is called in Windows) that is setting that option? Those are the kind of things I would look for. That said, there are alternatives to the whole ALTER SYSTEM / pg_reload_conf business. If you are going to include all of the testing commands within one psql connection, there isn't any need for the ALTER SYSTEM or reload, you can just send the SET commands first and then the others in the same session. Or, if you do want to save the settings for later reconnection, you could also do that with ALTER DATABASE or ALTER USER, and I think both of those will work inside transactions. Another alternative is to simply pass the settings with -c when starting the PostgreSQL server [2]: postgres -c pljava.libjvm_location="$libjvm" \ -c pljava.vmoptions='-ea:org.postgresql.pljava... -Xcheck:jni' (Note I'm writing Unixy syntax here; I don't use Windows enough to be sure of the right way to quote that, but it gives you the idea.) Those settings will apply to all sessions started in that run of the server. It would be odd to run a production server that way, but one that is just being started to run some tests, why not? And still another alternative is just to send the options as part of the psql connection string [3]: psql "dbname=postgres options='-c pljava.libjvm_location=$libjvm -c pljava.vmoptions=-ea:org.postgresql.pljava...\\\ -Xcheck:jni'" ... where again, I'm showing Unixy syntax. The tricky bit is getting a space inside a single option setting, which you can see takes three backslashes in the above. I have no idea what would be correct in Windows but if you figure it out, it's good practice for the Maven plugin work. Settings sent with the psql connection of course are in effect just for that session. Regards, -Chap [1] https://www.postgresql.org/docs/13/app-psql.html#R1-APP-PSQL-3 [2] https://www.postgresql.org/docs/13/app-postgres.html#id-1.9.5.14.6.3 [3] https://www.postgresql.org/docs/13/libpq-connect.html#LIBPQ-CONNSTRING