From: Japin Li <japinli@hotmail.com>
To: Japin Li <japinli@hotmail.com>
Cc: bernaridho@outlook.co.id
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17111: Database created, cannot be created, but reported as inexist
Date: Fri, 16 Jul 2021 18:50:57 +0800
Message-ID: <MEYP282MB16692D00512B089AC7FEC5D8B6119@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <MEYP282MB1669DC75FDBA257B834C52B4B6119@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
References: <17111-c66d4212978a0260@postgresql.org>
<MEYP282MB1669DC75FDBA257B834C52B4B6119@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
On Fri, 16 Jul 2021 at 17:11, Japin Li <japinli@hotmail.com> wrote:
> On Fri, 16 Jul 2021 at 06:04, PG Bug reporting form <noreply@postgresql.org> wrote:
>> The following bug has been logged on the website:
>>
>> Bug reference: 17111
>> Logged by: Bernaridho Hutabarat
>> Email address: bernaridho@outlook.co.id
>> PostgreSQL version: 12.7
>> Operating system: CentOS
>> Description:
>>
>> postgres=# \c Database
>> FATAL: database "Database" does not exist
>> Previous connection kept
>> postgres=# CREATE DATABASE Database;
>> ERROR: database "database" already exists
>> postgres=# DROP DATABASE Database;
>> DROP DATABASE
>> postgres=# CREATE DATABASE Database OWNER ServiceUser1;
>> CREATE DATABASE
>> postgres=# \c Database;
>> FATAL: database "Database" does not exist
>> Previous connection kept
>> postgres=# DROP DATABASE Database;
>> DROP DATABASE
>> postgres=# CREATE DATABASE Database OWNER postgres;
>> CREATE DATABASE
>> postgres=# \c Database;
>> FATAL: database "Database" does not exist
>> Previous connection kept
>> postgres=# DROP DATABASE Database;
>> DROP DATABASE
>> postgres=# \q
>
> This might be the \c command doesn't convert "Database" to "database",
> OTOH, the CREATE DATABASE & DROP DATABASE convert "Database" to "database" by default.
>
> Should we convert the string to lower case read_connect_arg() if it doesn't quoted?
I find read_connect_arg() has following code:
/*
* Ideally we should treat the arguments as SQL identifiers. But for
* backwards compatibility with 7.2 and older pg_dump files, we have to
* take unquoted arguments verbatim (don't downcase them). For now,
* double-quoted arguments may be stripped of double quotes (as if SQL * identifiers). By 7.4 or so, pg_dump files can be expected to
* double-quote all mixed-case \connect arguments, and then we can get rid
* of OT_SQLIDHACK.
*/
result = psql_scan_slash_option(scan_state, OT_SQLIDHACK, "e, true);
IIUC, this code is just for compatibility with 7.2 or older. If yes, is it
necessary for us to be compatible with 7.2 or older?
I try to change OT_SQLIDHACK to OT_SQLID, and all test case passed.
Can we remove the code for compatibility with 7.2 or older?
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: japinli@hotmail.com, bernaridho@outlook.co.id
Subject: Re: BUG #17111: Database created, cannot be created, but reported as inexist
In-Reply-To: <MEYP282MB16692D00512B089AC7FEC5D8B6119@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
References: <17111-c66d4212978a0260@postgresql.org> <MEYP282MB1669DC75FDBA257B834C52B4B6119@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM> <MEYP282MB16692D00512B089AC7FEC5D8B6119@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
* 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