Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.postgresql > #833
| From | Laurenz Albe <laurenz@nospam.pn> |
|---|---|
| Newsgroups | comp.databases.postgresql |
| Subject | Re: Query regarding psql command |
| Date | 2018-05-25 11:05 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <pe8qmm$3ia$1@dont-email.me> (permalink) |
| References | <21afb065-12b9-47ec-959d-c3f4685c32b0@googlegroups.com> |
On Thu, 24 May 2018 23:34:23 -0700, ajat.prabha.leo wrote: > I'm an undergrad student and very new to postgresql. I have a question > to which I haven't been able to find an answer yet. > I installed postgresql and ran the command `psql -U postgres` and as > expected it failed because the role doesn't exist. > > But when I tried to run `psql postgres`, it worked! My question is why > is this command working? I've not been able to find this command > anywhere in the documentation. > > Now, I also created the role postgres and both commands are working. > > Note: when I run `psql postgres` the logged-in user is the superuser to > OS. I'm doing this on High Sierra. It must be that your installation process named the default superuser differently when it ran "initdb" to create the cluster. You can use this query to find the name of the default superuser: SELECT usename FROM pg_user WHERE usesysid = 10; Your attempt with "psql postgres" succeeded because the default superuser happened to have the same name as your operating system user, and that's the default that psql uses if you don't specify the -U option. You can rename a user with ALTER USER ... RENAME TO ...; But you shouldn't forget that renaming a user clears the password, so you have to set it again with \password.
Back to comp.databases.postgresql | Previous | Next — Previous in thread | Next in thread | Find similar
Query regarding psql command ajat.prabha.leo@gmail.com - 2018-05-24 23:34 -0700
Re: Query regarding psql command Laurenz Albe <laurenz@nospam.pn> - 2018-05-25 11:05 +0000
Re: Query regarding psql command ajat.prabha.leo@gmail.com - 2018-05-25 05:25 -0700
csiph-web