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 1sLT2u-00EzlA-6h for pgsql-general@arkaria.postgresql.org; Sun, 23 Jun 2024 19:38:40 +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 1sLT2q-00Fulp-Ph for pgsql-general@arkaria.postgresql.org; Sun, 23 Jun 2024 19:38:37 +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 1sLT2q-00Fulh-9J for pgsql-general@lists.postgresql.org; Sun, 23 Jun 2024 19:38:36 +0000 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sLT2n-002lR2-PW for pgsql-general@lists.postgresql.org; Sun, 23 Jun 2024 19:38:35 +0000 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-5b97a9a9b4bso1785641eaf.0 for ; Sun, 23 Jun 2024 12:38:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719171513; x=1719776313; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=3coRAxDAUqGPkbNUPssxDTIVw54PVJojCQOYw8+uNcc=; b=gKEHS7ZBQKwADY9jJQxqB1p1t2aokqQuxNLIDpHnkPycOiVynoWVBfgvLd7qt8ZPAa k9gLLLAhtt9lV/P88qfBnbgG84p1VgE1rY+gpPmlc+mW0nftjXiOeZp7zWHtTg4tJkGb p9KDsEk+/AYppoLeM7zdewPHlISTwhxg69KoJ2oNkYh9RipL/dnKCvSj3s8W/AHqoZPB fCZUJt+iaydfc8a9KQzBqq8nkBXs4Av9JdWWBISLKW2QNbljETBhg6uD94c8u0T6FOip QO6lAmR53q8DCTG4Bysx5ePOWnSMJ9xrFOetyWBr6IMTlMGCVACTrNPNNgz5XkHMd+eI bnUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719171513; x=1719776313; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3coRAxDAUqGPkbNUPssxDTIVw54PVJojCQOYw8+uNcc=; b=YFp3uH5ADY4tyCsM8AA1/tro09K8WdxsEO25M42KlRRwOgDaKkkHmsl5waW8yzhnI6 RdnXqDjbAwoqzv06a2LwHvWu87leA85s6wT9n69U13rstZezMGew6LWCSpjl9sKcy4Cz air1MzPF4yBSGWC8MWKacUyvkbXxhRG5VpCU8aySQiVt+rfJBs37B4LVvGG6QXWvviCR 36303izpO9pCM8ICutZC1o5VL9hZKnHKX+FZwba9zvpp5JQh73PuGIrjSICFzQjKbhdc mlnkCxCDdwpckQJxe+enmYstoaNBDNxH3XR4qqnv1tInaPIM54rJcXUjOuk0UKT5m+EU rgIw== X-Gm-Message-State: AOJu0YxxLoP33+HYB1V2/rFeTml7Vhm8Q/ikbeEho+rE/LeDrytH6C8Q W1HIav7+ItntUyCk+jrB0qsigc12B8JggVY9jjrB1V82Tb5E+Du6Ef9b7EsRDBu9Y121QTlnGnV ihp0Lz+8ag6LF7a/etx8JACvPr/S9Pvsh X-Google-Smtp-Source: AGHT+IEaOE38L7UjuEjOZFUVCt346krrmg2rUZJ9uEMTgCxz0qQpaC73HLPLfxUzoLZ2yORopsW7GfTv2O4U9aJ945k= X-Received: by 2002:a05:6870:7021:b0:254:948e:bf08 with SMTP id 586e51a60fabf-25d016dc5eamr3459082fac.31.1719171512451; Sun, 23 Jun 2024 12:38:32 -0700 (PDT) MIME-Version: 1.0 References: <540f69f.2ec4.1904668b6c4.Coremail.krave@163.com> <6697c935.2f13.190468ca053.Coremail.krave@163.com> In-Reply-To: <6697c935.2f13.190468ca053.Coremail.krave@163.com> From: Ron Johnson Date: Sun, 23 Jun 2024 15:38:21 -0400 Message-ID: Subject: Re: Re: How to use createdb command with newly created user? To: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000004eca9b061b93cf03" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000004eca9b061b93cf03 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Better to run now, and save yourself hassle in the future: ALTER ROLE "Baba" RENAME TO baba; Also, use a .pgpass file: https://www.postgresql.org/docs/14/libpq-pgpass.html On Sun, Jun 23, 2024 at 3:22=E2=80=AFPM =E6=AF=9B=E6=AF=9B = wrote: > > > Thank you! You are right! > > After putting quotes around the username, it works! > > > > =E5=9C=A8 2024-06-24 02:47:44=EF=BC=8C"David G. Johnston" =E5=86=99=E9=81=93=EF=BC=9A > > > > On Sun, Jun 23, 2024, 11:43 =E6=AF=9B=E6=AF=9B wrote: > >> Hi, >> >> I tried to create a user with CREATEDB permission. >> Then I wanted to run command line tool `createdb` with this newly create= d >> user. >> >> So I ran SQL first to create a user: >> >> ``` >> CREATE USER Baba WITH PASSWORD 'xxx' CREATEDB; >> ``` >> >> 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. >> >> If I specify the user as postgres, the defaut user, everything works fin= e. >> >> ``` >> createdb -U postgres -W test_db_1 >> ``` >> >> Do you have any suggestions? >> > > > 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 > !=3D baba is your issue. > > David J. > > --0000000000004eca9b061b93cf03 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Better to run now, and save yourself hassle in the fu= ture:
ALTER ROLE "Baba" RENAME TO baba;

<= /div>
On Sun, Jun 23, 2024 at 3:22=E2=80=AFPM =E6=AF=9B=E6=AF=9B <= krave@163.com> wrote:



Thank you! You are right!

After putting quotes around the username, it works!



=E5=9C=A8 2024-06-24 02:47:44=EF=BC=8C"David G. Johnsto= n" <david.g.johnston@gmail.com> =E5=86=99=E9=81=93=EF=BC=9A



On Sun, Jun 23, 2024, 11:43 =E6=AF=9B=E6=AF=9B <krave@163.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">
Hi,

I tried to create a user with CREATEDB permission.
Then I wanted to run command line tool `createdb` with this newly = created user.

So I ran SQL first to create a user:
<= br>
```
C= REATE USER Baba WITH PASSWORD 'xxx' CREATEDB;
```

Then I run the following command on PowerShell on Windows 10:

```
=
=C2=A0createdb -U Baba -W test_db
```

But no mater how I tried, the password always failed.

If I specify the = user as postgres, the defaut user, everything works fine.

```
createdb -U postgres -W test_db_1
```

Do= you have any suggestions?


You named= the user "baba" all lower-case but your createdb command uses Ba= ba and in the OS the case-folding of identifiers does not happen.=C2=A0 Bab= a !=3D baba=C2=A0 is your issue.

David J.
--0000000000004eca9b061b93cf03--