pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: FATAL: database "xxx" does not exist when it does
4+ messages / 3 participants
[nested] [flat]

* Re: FATAL: database "xxx" does not exist when it does
@ 2023-02-01 20:13 Siddharth Jain <siddhsql@gmail.com>
  2023-02-01 20:15 ` Re: FATAL: database "xxx" does not exist when it does Rodrigo Luna <rodrigomrluna78@gmail.com>
  2023-02-01 20:45 ` Re: FATAL: database "xxx" does not exist when it does Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 4+ messages in thread

From: Siddharth Jain @ 2023-02-01 20:13 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

>
>
>
> using Postgres 14.4, I created a database as the postgres user:
>>
>> create database xxx;
>>
>> postgres=> \c xxx
>> psql (13.9 (Debian 13.9-0+deb11u1), server 14.4)
>> WARNING: psql major version 13, server major version 14.
>>          Some psql features might not work.
>> SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits:
>> 256, compression: off)
>> You are now connected to database "xxx" as user "postgres".
>>
>> i gave all privileges on xxx to user sysbench:
>>
>> postgres=> GRANT ALL PRIVILEGES ON DATABASE xxx TO sysbench;
>>
>> i can see:
>>
>> Name     |      Owner       | Encoding | Collate |  Ctype  |
>> Access privileges
>>
>> --------------+------------------+----------+---------+---------+---------------------------------------
>>  xxx         | postgres         | UTF8     | C.UTF-8 | C.UTF-8 |
>> =Tc/postgres                         +
>>               |                  |          |         |         |
>> postgres=CTc/postgres                +
>>               |                  |          |         |         |
>> sysbench=CTc/postgres
>>
>> but user sysbench is not able to connect to this database:
>>
>> sysbench=> \c xxx
>> FATAL:  database "xxx" does not exist
>> Previous connection kept
>>
>> how can i fix this?
>>
>

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

* Re: FATAL: database "xxx" does not exist when it does
  2023-02-01 20:13 Re: FATAL: database "xxx" does not exist when it does Siddharth Jain <siddhsql@gmail.com>
@ 2023-02-01 20:15 ` Rodrigo Luna <rodrigomrluna78@gmail.com>
  2023-02-01 20:19   ` Re: FATAL: database "xxx" does not exist when it does Rodrigo Luna <rodrigomrluna78@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Rodrigo Luna @ 2023-02-01 20:15 UTC (permalink / raw)
  To: Siddharth Jain <siddhsql@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

Even on the create role you set login?

Rodrigo Dev
Visite: https://rodrigoluna.net.br
YouTube: GamesBR

> Em 1 de fev. de 2023, à(s) 17:13, Siddharth Jain <siddhsql@gmail.com> escreveu:
> 
> 
>> 
>> 
>>> using Postgres 14.4, I created a database as the postgres user:
>>> 
>>> create database xxx;
>>> 
>>> postgres=> \c xxx
>>> psql (13.9 (Debian 13.9-0+deb11u1), server 14.4)
>>> WARNING: psql major version 13, server major version 14.
>>>          Some psql features might not work.
>>> SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
>>> You are now connected to database "xxx" as user "postgres".
>>> 
>>> i gave all privileges on xxx to user sysbench:
>>> 
>>> postgres=> GRANT ALL PRIVILEGES ON DATABASE xxx TO sysbench;
>>> 
>>> i can see:
>>> 
>>> Name     |      Owner       | Encoding | Collate |  Ctype  |           Access privileges
>>> --------------+------------------+----------+---------+---------+---------------------------------------
>>>  xxx         | postgres         | UTF8     | C.UTF-8 | C.UTF-8 | =Tc/postgres                         +
>>>               |                  |          |         |         | postgres=CTc/postgres                +
>>>               |                  |          |         |         | sysbench=CTc/postgres
>>> 
>>> but user sysbench is not able to connect to this database:
>>> 
>>> sysbench=> \c xxx
>>> FATAL:  database "xxx" does not exist
>>> Previous connection kept
>>> 
>>> how can i fix this?

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

* Re: FATAL: database "xxx" does not exist when it does
  2023-02-01 20:13 Re: FATAL: database "xxx" does not exist when it does Siddharth Jain <siddhsql@gmail.com>
  2023-02-01 20:15 ` Re: FATAL: database "xxx" does not exist when it does Rodrigo Luna <rodrigomrluna78@gmail.com>
@ 2023-02-01 20:19   ` Rodrigo Luna <rodrigomrluna78@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Rodrigo Luna @ 2023-02-01 20:19 UTC (permalink / raw)
  To: Siddharth Jain <siddhsql@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

Change the owner to xxx too.

Rodrigo Dev
Visite: https://rodrigoluna.net.br
YouTube: GamesBR

> Em 1 de fev. de 2023, à(s) 17:15, Rodrigo Luna <rodrigomrluna78@gmail.com> escreveu:
> 
> Even on the create role you set login?
> 
> Rodrigo Dev
> Visite: https://rodrigoluna.net.br
> YouTube: GamesBR
> 
>> Em 1 de fev. de 2023, à(s) 17:13, Siddharth Jain <siddhsql@gmail.com> escreveu:
>> 
>> 
>>> 
>>> 
>>>> using Postgres 14.4, I created a database as the postgres user:
>>>> 
>>>> create database xxx;
>>>> 
>>>> postgres=> \c xxx
>>>> psql (13.9 (Debian 13.9-0+deb11u1), server 14.4)
>>>> WARNING: psql major version 13, server major version 14.
>>>>          Some psql features might not work.
>>>> SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
>>>> You are now connected to database "xxx" as user "postgres".
>>>> 
>>>> i gave all privileges on xxx to user sysbench:
>>>> 
>>>> postgres=> GRANT ALL PRIVILEGES ON DATABASE xxx TO sysbench;
>>>> 
>>>> i can see:
>>>> 
>>>> Name     |      Owner       | Encoding | Collate |  Ctype  |           Access privileges
>>>> --------------+------------------+----------+---------+---------+---------------------------------------
>>>>  xxx         | postgres         | UTF8     | C.UTF-8 | C.UTF-8 | =Tc/postgres                         +
>>>>               |                  |          |         |         | postgres=CTc/postgres                +
>>>>               |                  |          |         |         | sysbench=CTc/postgres
>>>> 
>>>> but user sysbench is not able to connect to this database:
>>>> 
>>>> sysbench=> \c xxx
>>>> FATAL:  database "xxx" does not exist
>>>> Previous connection kept
>>>> 
>>>> how can i fix this?

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

* Re: FATAL: database "xxx" does not exist when it does
  2023-02-01 20:13 Re: FATAL: database "xxx" does not exist when it does Siddharth Jain <siddhsql@gmail.com>
@ 2023-02-01 20:45 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 4+ messages in thread

From: Tom Lane @ 2023-02-01 20:45 UTC (permalink / raw)
  To: Siddharth Jain <siddhsql@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

Siddharth Jain <siddhsql@gmail.com> writes:
> postgres=> \c xxx
> psql (13.9 (Debian 13.9-0+deb11u1), server 14.4)
> WARNING: psql major version 13, server major version 14.
> Some psql features might not work.

I wonder whether your problem is related to this version mismatch.
I'm not entirely sure how that would happen, but older psql with
newer server is certainly not a heavily-tested case.

> i gave all privileges on xxx to user sysbench:
> postgres=> GRANT ALL PRIVILEGES ON DATABASE xxx TO sysbench;

[ squint... ]  Your prompt indicates you are not superuser here.
Is this really an accurate transcript of what you did?

> sysbench=> \c xxx
> FATAL:  database "xxx" does not exist
> Previous connection kept

If I had to guess on the basis of this much info, I'd guess that
there's more than one Postgres cluster on this machine, one of
which now has an "xxx" database while another does not, and
psql is somehow trying to connect to the latter one at this point.

Possibly this has to do with the version mismatch; I'm not very
sure offhand whether \c will preserve prior values for options
like port number in this context.  Especially if you are using
version-mismatched psql and libpq, which seems moderately likely.

			regards, tom lane





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


end of thread, other threads:[~2023-02-01 20:45 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-02-01 20:13 Re: FATAL: database "xxx" does not exist when it does Siddharth Jain <siddhsql@gmail.com>
2023-02-01 20:15 ` Rodrigo Luna <rodrigomrluna78@gmail.com>
2023-02-01 20:19   ` Rodrigo Luna <rodrigomrluna78@gmail.com>
2023-02-01 20:45 ` Tom Lane <tgl@sss.pgh.pa.us>

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