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 1oIrNT-0005TO-17 for pgsql-general@arkaria.postgresql.org; Tue, 02 Aug 2022 12:52:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oIrNR-0007zO-V2 for pgsql-general@arkaria.postgresql.org; Tue, 02 Aug 2022 12:52:01 +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 1oIrNR-0007zF-KS for pgsql-general@lists.postgresql.org; Tue, 02 Aug 2022 12:52:01 +0000 Received: from mail.thenautilus.net ([178.162.154.203]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIrNL-0006RZ-CY for pgsql-general@lists.postgresql.org; Tue, 02 Aug 2022 12:52:01 +0000 Received: (qmail 25169 invoked from network); 29 Jul 2022 09:05:18 -0000 Received: from unknown (HELO nautilus) (dakkar@::ffff:81.2.107.215) by 0 with ESMTPA; 29 Jul 2022 09:05:18 -0000 Date: Fri, 29 Jul 2022 10:05:18 +0100 From: Gianni Ceccarelli To: pgsql-general@lists.postgresql.org Subject: Re: Syntax error when combining --set and --command has me stumped Message-ID: <20220729100518.6a8f819e@nautilus> In-Reply-To: References: <352ceea1-029d-726e-89b5-74be4946e67b@gmail.com> X-Mailer: Claws Mail 4.1.0git11 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk If you can use bash, or set up some redirections from whatever you're using to execute ``psql``, you can do:: $ psql somedb --set num=3D42 <<<'select :num' Timing is on. Expanded display is used automatically. Line style is unicode. Border style is 2. =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=90 =E2=94=82 ?column? =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 42 =E2=94=82 =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=98 (1 row) Time: 0.517 ms or (more classically):: echo 'select :num' | psql somedb --set num=3D42 --=20 Dakkar - GPG public key fingerprint =3D A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id =3D 0x75193F88