Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLSSI-00ExXA-65 for pgsql-general@arkaria.postgresql.org; Sun, 23 Jun 2024 19:00:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sLSSF-00FR4S-KM for pgsql-general@arkaria.postgresql.org; Sun, 23 Jun 2024 19:00:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLSSF-00FR4J-9O for pgsql-general@lists.postgresql.org; Sun, 23 Jun 2024 19:00:47 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLSSC-002lDP-VD for pgsql-general@lists.postgresql.org; Sun, 23 Jun 2024 19:00:46 +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 45NJ0bxY987120; Sun, 23 Jun 2024 15:00:37 -0400 From: Tom Lane To: "David G. Johnston" cc: =?UTF-8?B?5q+b5q+b?= , pgsql-general@lists.postgresql.org Subject: Re: How to use createdb command with newly created user? In-reply-to: References: <540f69f.2ec4.1904668b6c4.Coremail.krave@163.com> Comments: In-reply-to "David G. Johnston" message dated "Sun, 23 Jun 2024 11:47:44 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <987118.1719169237.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sun, 23 Jun 2024 15:00:37 -0400 Message-ID: <987119.1719169237@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > On Sun, Jun 23, 2024, 11:43 毛毛 wrote: >> Then I run the following command on PowerShell on Windows 10: >> createdb -U Baba -W test_db >> But no mater how I tried, the password always failed. > You named the user "baba" all lower-case but your createdb command uses > Baba and in the OS the case-folding of identifiers does not happen. Baba > != baba is your issue. FWIW, I think using -W in interactive commands is a bad habit that you should drop. Because it forces a password prompt, it easily confuses people into thinking that their problem is password-related whether it actually is or not. (I notice that with createdb, it actually seems to force *two* password prompts when there is something wrong. That's unlike what happens with psql; maybe we should try to improve that. But on the other hand, it's hard to get excited about putting work into improving a behavior that we deprecate using at all.) regards, tom lane