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 1oybG3-0001c9-Kg for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Nov 2022 16:08:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oybG2-0004ZG-Fo for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Nov 2022 16:08:54 +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 1oybG2-0004Z7-7g for pgsql-bugs@lists.postgresql.org; Fri, 25 Nov 2022 16:08:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oybFz-0002Dz-Pe for pgsql-bugs@lists.postgresql.org; Fri, 25 Nov 2022 16:08:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2APG8nlh4059189; Fri, 25 Nov 2022 11:08:49 -0500 From: Tom Lane To: "David G. Johnston" cc: PostgreSQL Bug List Subject: Re: Bug or intentionally under-documented "\c databasename;" behavior? In-reply-to: References: Comments: In-reply-to "David G. Johnston" message dated "Fri, 25 Nov 2022 08:50:57 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4059187.1669392529.1@sss.pgh.pa.us> Date: Fri, 25 Nov 2022 11:08:49 -0500 Message-ID: <4059188.1669392529@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > I expected the following to tell me: database "testdb;" does not exist > Instead the connection attempt was successful. > postgres=# create database testdb; > CREATE DATABASE > postgres=# \c testdb; > You are now connected to database "testdb" as user "vagrant". This is because psql_scan_slash_option was told to strip any trailing semicolon, and did so. If there's any rhyme or reason to which psql metacommands pass semicolon=true and which do not, I can't detect it :-(. And you're right that there's nothing about it in the documentation. I wonder if we can get away with removing that quirk. Or else try to establish some policy about it, and document the policy. A really brave person might propose nuking the OT_SQLIDHACK parsing mode as well. That was never supposed to be a long-term fixture. regards, tom lane