Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xDcI8-00000000cCw-45Nb for pgsql-general@arkaria.postgresql.org; Mon, 05 Oct 2026 06:35:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xDcI7-00000008M6b-0RXy for pgsql-general@arkaria.postgresql.org; Mon, 05 Oct 2026 06:35:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xDcI6-00000008M6S-3CKc for pgsql-general@lists.postgresql.org; Mon, 05 Oct 2026 06:35:14 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xDcI4-00000000Tvj-1AIS for pgsql-general@lists.postgresql.org; Mon, 05 Oct 2026 06:35:14 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4a1688d7769so9177715e9.0 for ; Sun, 04 Oct 2026 23:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1791182111; x=1791786911; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:to:from:subject:message-id:from:to:cc :subject:date:message-id:reply-to:content-type; bh=JQSN12c22797KpNQpuW5jVHfle46JfJHleSUKFPvJzE=; b=sbiAQz+pgYGFnhQ7myUYZN6oKFzZs+EVHflGXaZ+PlE+E44K3z6z0wGrbRCIp5VMoG 1PVG2LEKd8OrbcAFunoaC3sldbTY10p2MaoNZWk+iK/Ebb2FWpQRguZBXaRZDHoXpjWt vpiXpbnwJTFNEmDS6WzFfX5BRxCQAwqjGDw2pRCXoWpr0raYsyOJHIy43TAMSjvkydjo dlQtxR1TejaY+KbUHdj/Icdw7y3h4Bh3oPqn2vWWPFv0Hsk+Ai3J4k0DmrRysDmqtp7b hXoOxhK3vNx2b2JybOgLlbSEbsh+YfZZ4Dw/AYLgNdXQhRFIXUJIy/GpSQEorguyLSBG PaeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791182111; x=1791786911; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=JQSN12c22797KpNQpuW5jVHfle46JfJHleSUKFPvJzE=; b=FKGOUrxTdPBkEqG9qVnI/A9WWdDC6Du7We4cfF2ipRrGcfh7tNDT4URc3w980jxmwG z1Otka/pizWfMnMtPBbQrvb0e97E4htfLFW0IIvCB2IT9O0b2MxCG0xAPHW+YEMRIKYS APHs0PJU0g6dXeApilgS09uLkmeIYdfWpw9Xb5lq5Vu0PftXN2vcJ7UxpOOstiSQ3UzX dT1C3BrymD05RUypsUBqYXp8VqGQNwKfZjBCES26qXHD0Uk8pUkDkdyymIly5VSDEJ8Y 9+gY0ZL8sr/B/ymcz6n/sFdarJi8+1s+FkxfMN3L+cJMLGkMODpQoo0qXkUecVQDK9EG 82LA== X-Forwarded-Encrypted: i=1; AKwUvBw3Ep6WqsdNRuMJuj2eZ2J+pCQnB+XJcAUTsO3Ri/4MQ8bkQ6DxncRuUYT40Rnt2uhe4AS3ubEGFJ96biEw@lists.postgresql.org X-Gm-Message-State: AFuF++lVgeTyr7jp4dHwPtH/6X0uSC2Yo454TPHGdo1KkJ9weUs/pxNK pTFbSsd4UeIX0oHvxYgmpqBNv6Ul/IbmYXwk2YH0ZGLtmGrdhzP5pD78g1mes91G0nc= X-Gm-Gg: AYBFou01s4EcbkdtBoJOVBQrlWy6cp+hz9omMsmHptcwaWVfW7kWPFxZhpbqmuXF3kI LDkaHvfck4uzsf2y9EQtFCfLbevYZdXSeD3wXx39WmKezMNr20LU/pmrVMx5dWs7BRB6FNUebaL a4amwg3IRx430VLGwnrmg3oHNkU3G3r7HaUY/8Hi4NXO9YVhaENOeCAPgL7H1mM3rBvwJDSNIlq 88x/84K4eTAM9+nxlS5BCykLBuVDOuBYp2/mQjn4EC3YFllFGFwqgj2PGsao4jGoAsiXq4een+y oSleF5mcd4rmXrvNRv7pp4oqUKmErLZOiOaCxuz5QgYGHfYv+5LktNVcUZZ99InPMs03FD0LUHt +RlC/giZfNBLMo2+vXWzb8gvop+qo8em18idFFgxD3NbgdzqULe0NKO7jsYjG8Sf2w/vRVsg30A UEqgEkevSXbxE/usN1lf30pgsR0gRJHfR49JPx+5+Sy/mF5SfSBBMHCAugN7AbKN6K2QoLe2rWv sGfLtv0SoS75khw2ph2gFa7Ap5VDgU= X-Received: by 2002:a05:600c:3556:b0:499:79b9:e220 with SMTP id 5b1f17b1804b1-4a1680e7748mr112106345e9.10.1791182110961; Sun, 04 Oct 2026 23:35:10 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:270:b677:677f:591c:a18a:2956]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48c622affadsm1406216f8f.40.2026.10.04.23.35.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Oct 2026 23:35:10 -0700 (PDT) Message-ID: <65b18907e04e181eca7166e49bfa48314d6d31d3.camel@cybertec.at> Subject: Re: libpq analog of \c From: Laurenz Albe To: Igor Korot , "pgsql-generallists.postgresql.org" Date: Mon, 05 Oct 2026 08:35:09 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.2 (3.60.2-2.fc44) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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