public inbox for [email protected]  
help / color / mirror / Atom feed
From: 毛毛 <[email protected]>
To: pgsql-generallists.postgresql.org <[email protected]>
Subject: Re:Re: Re: How to use createdb command with newly created user?
Date: Mon, 24 Jun 2024 11:36:33 +0800 (CST)
Message-ID: <[email protected]> (raw)
In-Reply-To: <CANzqJaCkH5BqXKi8zB8QCSbxBrv8W=GNf-HfADg4thm2V9zqTw@mail.gmail.com>
References: <[email protected]>
	<CAKFQuwb-Kp4dnE+EM2WCeJ8tuai-Lx_Ja2Gb8mEOkNRe9h8Vww@mail.gmail.com>
	<[email protected]>
	<CANzqJaCkH5BqXKi8zB8QCSbxBrv8W=GNf-HfADg4thm2V9zqTw@mail.gmail.com>







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" <[email protected]> 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 PM 毛毛 <[email protected]> wrote:








Thank you! You are right!


After putting quotes around the username, it works!








在 2024-06-24 02:47:44,"David G. Johnston" <[email protected]> 写道:




On Sun, Jun 23, 2024, 11:43 毛毛 <[email protected]> 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.

view thread (3+ messages)  latest in thread

reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re:Re: Re: How to use createdb command with newly created user?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox