From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: PostgreSQL Bug List <pgsql-bugs@lists.postgresql.org>
Subject: Re: Bug or intentionally under-documented "\c databasename;" behavior?
Date: Fri, 25 Nov 2022 11:08:49 -0500
Message-ID: <4059188.1669392529@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwYwWh9wNWxbFAc_9apovbRo9Sfe8jRM7Mf98C8Tn2dE9A@mail.gmail.com>
References: <CAKFQuwYwWh9wNWxbFAc_9apovbRo9Sfe8jRM7Mf98C8Tn2dE9A@mail.gmail.com>
"David G. Johnston" <david.g.johnston@gmail.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: Bug or intentionally under-documented "\c databasename;" behavior?
In-Reply-To: <4059188.1669392529@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox