Re: Re: Re: How to use createdb command with newly created user?

Поиск
Список
Период
Сортировка
От Muhammad Ikram
Тема Re: Re: Re: How to use createdb command with newly created user?
Дата
Msg-id CAGeimVrrfG_bRrVKKzg=gWwbEZ=EXfic6Q9oL2oyYupqFfOqng@mail.gmail.com
обсуждение исходный текст
Ответ на Re:Re: Re: How to use createdb command with newly created user?  (毛毛 <krave@163.com>)
Список pgsql-general
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 AM 毛毛 <krave@163.com> 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" <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 PM 毛毛 <krave@163.com> wrote:



Thank you! You are right!

After putting quotes around the username, it works!



在 2024-06-24 02:47:44,"David G. Johnston" <david.g.johnston@gmail.com> 写道:



On Sun, Jun 23, 2024, 11:43 毛毛 <krave@163.com> 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.  Baba != baba  is your issue.

David J.


--
Muhammad Ikram

В списке pgsql-general по дате отправления:

Предыдущее
От: 毛毛
Дата:
Сообщение: Re:Re: Re: How to use createdb command with newly created user?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: How to use createdb command with newly created user?