From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Igor Korot <ikorot01@gmail.com>
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: libpq analog of \c
Date: Mon, 05 Oct 2026 08:35:09 +0200
Message-ID: <65b18907e04e181eca7166e49bfa48314d6d31d3.camel@cybertec.at> (raw)
In-Reply-To: <CA+FnnTzOQvdn9Kb36Sb02mrF06TALVMi3mzoJKCdQ0YdJwnMew@mail.gmail.com>
References: <CA+FnnTzOQvdn9Kb36Sb02mrF06TALVMi3mzoJKCdQ0YdJwnMew@mail.gmail.com>
On Sun, 2026-10-04 at 23:09 -0700, Igor Korot wrote:
> What do issue in the libpq interface to
> select the current database?
You cannot select the current database. A database connection remains
connected to the same database for the entire time of the connection.
You'll have to do what psql does: connect to the second database, and
if that succeeds, disconnect from the first one.
Yours,
Laurenz Albe
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: laurenz.albe@cybertec.at, ikorot01@gmail.com
Subject: Re: libpq analog of \c
In-Reply-To: <65b18907e04e181eca7166e49bfa48314d6d31d3.camel@cybertec.at>
References: <CA+FnnTzOQvdn9Kb36Sb02mrF06TALVMi3mzoJKCdQ0YdJwnMew@mail.gmail.com> <65b18907e04e181eca7166e49bfa48314d6d31d3.camel@cybertec.at>
* 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