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 1sLaju-00FYDb-66 for pgsql-general@arkaria.postgresql.org; Mon, 24 Jun 2024 03:51:34 +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 1sLajr-003xUO-0l for pgsql-general@arkaria.postgresql.org; Mon, 24 Jun 2024 03:51:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sLajq-003xUE-HL for pgsql-general@lists.postgresql.org; Mon, 24 Jun 2024 03:51:30 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sLajo-003Eo1-59 for pgsql-general@lists.postgresql.org; Mon, 24 Jun 2024 03:51:30 +0000 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-52ce01403f6so1177517e87.0 for ; Sun, 23 Jun 2024 20:51:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719201087; x=1719805887; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=cUYeDrgWSNyen6MoD+z0i1yxM54LfzO9jBvcFm7qb3I=; b=FpYtGSKwlUndbZuTtzPZx6xQn6LAOfsAXyc0CLJkRi9ET7sC/0NorhTMtH6Xe3xnWW ZvIpM8SZ8FGazb2oXrguZft9AX8atx3OFBODR5jc5FQSdfQtChVyPk4NH5B/OW86ON+6 H+eXosWaHSw7BrS6QtUCJlp1ztCfTtOyLnGwPz76yXnbYykwjVnuizPW0MakHHD9+wDw JNEJPZRL7w0nEBmqX3K72VIfd2fTrSAxJgNoq31FEYrpkbGMi/oYJ+dNV+A3b/w01s9O a3nVGxMi9UawqcE0NiJaNJKb932zywwEkixLZ+jnSwij9CZrt8o08ouMd8GnsgXCYyXm KS0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719201087; x=1719805887; h=cc: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=cUYeDrgWSNyen6MoD+z0i1yxM54LfzO9jBvcFm7qb3I=; b=aELqXS8/q4BhrLkOBgtfdztj0SAC+uXQxcW31hdHoNJB071FscqhBNIRYt5mfJdBjh A8doYxJoaIvLSeDaILP+kVjdDvfwjmY2o2dY3QeiT9VjOYiStVO5zGN1+c3Idme++SX1 dEDcnNwViWj96tFkV/pN1o+gtdnL3NUJn9bdKBw7sksJR6kpK+SF30kGXwUcUlmlt/vI WSTDlDTV2xaMeoHf39GFPMMHaXzFEZR7uk9DwnfMtVnBGcBNB4nGb/lZwa9sTqDe+xSS Rzrc3ugNmZXZMKe15JeBHk/h1UVSKeY9jrehDUf+0zSsU6RYRn8/W9Vxlxtb2Zx9T7K3 urhQ== X-Gm-Message-State: AOJu0YyDD1MuYb6bMzg0cnmil3ac7+WHZrvnyIA0lLY8jrI1KI/f7QLs yr72+/51EzN6xAF6afsFB+PU3TOak9On+6VqbwNRdn21sx9QnQBR751srIHEko+D1jS6FwBVGcP S+iaErXmJH48ui0m8zOsBehJcEiXSdRX+TTZWyw== X-Google-Smtp-Source: AGHT+IE4sJHHHIoD7dnhXkfmx9Hwn2Ws7QeLb+8RU/bGJrwYHc3AAyXXCJinsu4+o0eFbgvwitT0Mg4+mqmKw2P4nyU= X-Received: by 2002:a05:6512:2394:b0:52c:d84c:1182 with SMTP id 2adb3069b0e04-52ce1862c12mr2012638e87.64.1719201086563; Sun, 23 Jun 2024 20:51:26 -0700 (PDT) MIME-Version: 1.0 References: <540f69f.2ec4.1904668b6c4.Coremail.krave@163.com> <6697c935.2f13.190468ca053.Coremail.krave@163.com> <5231216.46bb.19048511cac.Coremail.krave@163.com> In-Reply-To: <5231216.46bb.19048511cac.Coremail.krave@163.com> From: Muhammad Ikram Date: Mon, 24 Jun 2024 08:51:09 +0500 Message-ID: Subject: Re: Re: Re: How to use createdb command with newly created user? To: =?UTF-8?B?5q+b5q+b?= Cc: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000000fef77061b9ab28e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000000fef77061b9ab28e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Krave, It does not matter whether you use capital letters, mixed case or lower case. Things only matter when you use double quotes. E.g. "Baba" and "BABA" are different but Baba and BABA or baba are all the same. Double quotes make the things case sensitive. Double quoting lower case won't cause any issue (IMO) as this is the default PG case. Regards, Muhammad Ikram, Bitnine Global On Mon, Jun 24, 2024 at 8:36=E2=80=AFAM =E6=AF=9B=E6=AF=9B = wrote: > > > Thank you for your advice. > > .pgpass file would help a lot. > > > I recently started to writing SQL on PostgreSQL. > > I think I should use capitial letters as sparingly as possible for > identifiers. > > > At 2024-06-24 03:38:21, "Ron Johnson" wrote: > > 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 >>> created 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 >>> 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 >> Baba and in the OS the case-folding of identifiers does not happen. Bab= a >> !=3D baba is your issue. >> >> David J. >> >> --=20 Muhammad Ikram --0000000000000fef77061b9ab28e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Krave,

It does not matter whether yo= u use capital letters, mixed case or lower case. Things only matter when yo= u use double quotes. E.g. "Baba" and "BABA" are differe= nt but Baba and BABA or baba are all the same.
Double quotes make= the things case sensitive. Double quoting lower case won't cause any i= ssue (IMO) as this is the default PG case.

Regards= ,
Muhammad Ikram,
Bitnine Global




On Mon, Jun 24, 2024 at 8:36=E2=80=AFAM =E6= =AF=9B=E6=AF=9B <krave@163.com> = wrote:


=


Thank you for y= our advice.

.pgpass file would help a lot.


I recently st= arted to writing SQL on PostgreSQL.

I think I sh= ould use capitial letters as sparingly as possible for identifiers.

=


At 2024-06-24 03:38:21,= "Ron Johnson" <ronljohnsonjr@gmail.com> wrote:

= Better to run now, and save yourself hassle in the future:
ALTER = ROLE "Baba" RENAME TO baba;


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 qu= otes around the username, it works!


=


= =E5=9C=A8 2024-06-24 02:47:44=EF=BC=8C"David G. Johnston" <david.g.johnst= on@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:
Hi,

I tried to create a user with CREATEDB permission.
Then I wanted to run command line tool `createdb` with t= his newly created 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 Windo= ws 10:

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

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

If I spec= ify 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 u= ses Baba and in the OS the case-folding of identifiers does not happen.=C2= =A0 Baba !=3D baba=C2=A0 is your issue.

David J.


= --
<= div>Muhammad Ikram

--0000000000000fef77061b9ab28e--