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 1lE4po-0002l5-Rs for pgsql-general@arkaria.postgresql.org; Mon, 22 Feb 2021 06:36:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lE4pn-0001ku-P4 for pgsql-general@arkaria.postgresql.org; Mon, 22 Feb 2021 06:36:43 +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 1lE4pn-0001km-GL for pgsql-general@lists.postgresql.org; Mon, 22 Feb 2021 06:36:43 +0000 Received: from mout.gmx.net ([212.227.17.20]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lE4pk-0006Hs-MB for pgsql-general@lists.postgresql.org; Mon, 22 Feb 2021 06:36:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1613975798; bh=CvM/PdbmyRXJP2XdA+U3BXdIVaqe7qdGJ7m49+DUXB0=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=MrjDroda4UrETXcno0UuIrcgVC6mwUjujcoqNB+5AD+DxjQ4xTRi6wzqUkLv9KM7V UUM5sQtID7YGJHEOxOAYFwfRLNUMHmwSyE0VKgRe+1WQ2WHV6XTvRV5p+v8UjQcxW1 yoAlg6Bv6aSdNJ2jHV+Qb2UO7N9PfyjTrbcXEe80= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [10.1.32.82] ([185.40.248.10]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MAOJP-1l6hMz2jAR-00BquK for ; Mon, 22 Feb 2021 07:36:38 +0100 Subject: Re: Script checking to see what database it's connected to To: pgsql-general@lists.postgresql.org References: <0437e8e0-5686-9a10-b204-0b9df86e27ef@gmail.com> <222764a0-5650-5457-e536-488861cdd666@gmail.com> From: Thomas Kellerer Message-ID: Date: Mon, 22 Feb 2021 07:36:37 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:9gKK+nMZTX4tOThXiFJN710A+WY7jG/M67ZMm2f90jd/Ew+x9M4 zhfwzkGNdQEcuJAII4VyAKqIWtugos6ruf2fXRPnZ4bRQY6HMbYEWtvovS/yfzRwVKKMZtY dssQ4WN1FxIudlwzOp24adcWls1hkM60BFIZBzBOfe9KTYBhkqRro4nT9mydlBG68yy2W8J sBlHAoQEpLZXAvkJkGEEw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Nu+Atarw14I=:ex4tYo4yQSD1eTKyl1ydwL xXt5Qya97MCpJWF4ghyu6BDocCivtvoIAr9PFfkmUPKXF/4bc7rB/F3Va0XhqZ0533tq/sDhP ZuX/hiDQwCDQdV5vVC3u/IXfRZfv1WDE49pilhuEFiuB7DT96BMB5Ctqg0wWSRVzaiH/X/xaJ ruXaOW0GAIe2st11nGAh9h3zMxGGllcI+0EokaRSQDbpcKbSBPYjmLVHfiVBxj3u3y0O14r2I TKiLmYf/YxJAzJeDYK6ZDl+Lhp4mxHwwFRgU9VqvMK1ZplFzdoGz35n1Kj6T3KlzAoANJjJLj DaKqn8btxxafukYOxek9TIhy6hn5gGZfC4ip/6Z9rF0bEF85IaxVL15FmrRSzUvh5VpqEITSj +Ar2FeXj9WPVFrdstR1tZyF40RprLhoqpS8we3QQku8DtubWLXmoyY7LV6EsmbldIWplkiFQN d5zKZC6c9RY+7V+mJR/4sEUjVntObklx4KhqOhIm+MVOJHSAl+UM/LllHPRkov/ZtDMCzbcB+ ULIgzJdogmCgs0JGgw5chq74Z176H+4sfnMmuHC9pr4V/vBVPiCnEnKG5EnppKDLwvNj1TjoX i4kf7byZtObhemz2QhSwqst7ox6atTVjscul3Ms1Ax4ZexL4VW4STMux1YwzlH1ml4+/D9kQH CcEpAJY/lK42ZQQe+3ZupMjedurjCX+MVBu5PHmRxDfhZtGtfGTIqPqzhaWTA+n9U7GbwraNu FWhBEqx9Li5u1ck0OG7MeyERgzBk3Wf8fePa+alETva2mA7HW8zjc+l74Fg1+iS2/JVFxFZ+W m/5qMlyxNBN1OEqb+cQjtjiBlsCdj2DYpjfoNJkWwXueVhidYTrmdnjWxFeM9MDQzh/4N8sNc cZjwoNRkivchiVWPOICw== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Julien Rouhaud schrieb am 22.02.2021 um 02:19: >> The output: >> $ psql12 -f test_pg.sql >> t >> connected to postgres >> got here >> psql:test_pg.sql:15: ERROR: syntax error at or near "exit" >> LINE 1: exit > > Well, the supported commands did work. You should probably look at > https://www.postgresql.org/docs/current/app-psql.html, you'd see that > "exit" is not a supported command and you should instead use \q[uit]. > I recommend looking at the semantics of \quit though, given your next > message mentioning \include. Since v11 "exit" and "quit" are allowed if no previous input was given on = the line. It's only documented in the release notes[1] though, not in the manual. Thomas [1] https://www.postgresql.org/docs/release/11.0/