public inbox for [email protected]  
help / color / mirror / Atom feed
Re:Re: Re: How to use createdb command with newly created user?
3+ messages / 3 participants
[nested] [flat]

* Re:Re: Re: How to use createdb command with newly created user?
@ 2024-06-24 03:36 毛毛 <[email protected]>
  2024-06-24 03:51 ` Re: Re: Re: How to use createdb command with newly created user? Muhammad Ikram <[email protected]>
  2024-06-24 04:20 ` Re: How to use createdb command with newly created user? Adrian Klaver <[email protected]>
  0 siblings, 2 replies; 3+ messages in thread

From: 毛毛 @ 2024-06-24 03:36 UTC (permalink / raw)
  To: pgsql-generallists.postgresql.org <[email protected]>







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.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Re: Re: How to use createdb command with newly created user?
  2024-06-24 03:36 Re:Re: Re: How to use createdb command with newly created user? 毛毛 <[email protected]>
@ 2024-06-24 03:51 ` Muhammad Ikram <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Muhammad Ikram @ 2024-06-24 03:51 UTC (permalink / raw)
  To: 毛毛 <[email protected]>; +Cc: pgsql-generallists.postgresql.org <[email protected]>

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 毛毛 <[email protected]> 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" <[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.
>>
>>

-- 
Muhammad Ikram


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to use createdb command with newly created user?
  2024-06-24 03:36 Re:Re: Re: How to use createdb command with newly created user? 毛毛 <[email protected]>
@ 2024-06-24 04:20 ` Adrian Klaver <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Adrian Klaver @ 2024-06-24 04:20 UTC (permalink / raw)
  To: 毛毛 <[email protected]>; pgsql-generallists.postgresql.org <[email protected]>

On 6/23/24 20:36, 毛毛 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.

Take a look at:

https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

It will answer a lot of questions.


-- 
Adrian Klaver
[email protected]







^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-06-24 04:20 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-06-24 03:36 Re:Re: Re: How to use createdb command with newly created user? 毛毛 <[email protected]>
2024-06-24 03:51 ` Muhammad Ikram <[email protected]>
2024-06-24 04:20 ` Adrian Klaver <[email protected]>

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