From: Tom Lane <tgl@sss.pgh.pa.us>
To: Siddharth Jain <siddhsql@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: FATAL: database "xxx" does not exist when it does
Date: Wed, 01 Feb 2023 15:45:19 -0500
Message-ID: <1413383.1675284319@sss.pgh.pa.us> (raw)
In-Reply-To: <CAPqV3pQaDqJUOQBxiRQED8JoixNToey6A8LgvA20HYiQ2Z09AQ@mail.gmail.com>
References: <CAPqV3pSvANHT6WDd4WrkkJKcSCXKUHzRGEfmH=H=yVuGdiZsaA@mail.gmail.com>
<CAPqV3pRr1rjkpRdwVkhNuSy2yZPamXmW-fKD8LRwe+Q-Dxd79g@mail.gmail.com>
<CAPqV3pQaDqJUOQBxiRQED8JoixNToey6A8LgvA20HYiQ2Z09AQ@mail.gmail.com>
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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, siddhsql@gmail.com
Subject: Re: FATAL: database "xxx" does not exist when it does
In-Reply-To: <1413383.1675284319@sss.pgh.pa.us>
References: <CAPqV3pSvANHT6WDd4WrkkJKcSCXKUHzRGEfmH=H=yVuGdiZsaA@mail.gmail.com> <CAPqV3pRr1rjkpRdwVkhNuSy2yZPamXmW-fKD8LRwe+Q-Dxd79g@mail.gmail.com> <CAPqV3pQaDqJUOQBxiRQED8JoixNToey6A8LgvA20HYiQ2Z09AQ@mail.gmail.com> <1413383.1675284319@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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