Re: libpq analog of \c - Mailing list pgsql-general

From Igor Korot
Subject Re: libpq analog of \c
Date
Msg-id CA+FnnTwDLKReWR+tkqh77brEd_Xo1wAp2KnFjJ_zkihbPE-0Nw@mail.gmail.com
Whole thread
In response to Re: libpq analog of \c  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: libpq analog of \c
List pgsql-general
Hi,



On Sun, Oct 4, 2026, 11:35 PM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
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.

Where do I look for that code?

Thank you.


Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: bug or feature
Next
From: Adrian Klaver
Date:
Subject: Re: libpq analog of \c