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.94.2) (envelope-from ) id 1uZIsY-001TcP-T5 for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Jul 2025 00:41:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uZIsW-00CcmO-Om for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Jul 2025 00:41:41 +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.94.2) (envelope-from ) id 1uZIsW-00CcmG-Er for pgsql-hackers@lists.postgresql.org; Wed, 09 Jul 2025 00:41:41 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uZIsU-006YHs-2h for pgsql-hackers@lists.postgresql.org; Wed, 09 Jul 2025 00:41:40 +0000 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-74924255af4so4377678b3a.1 for ; Tue, 08 Jul 2025 17:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1752021695; x=1752626495; darn=lists.postgresql.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=lN7K5g+Sf0Yxb8pRGTAZdG7LE65bww5zRZwGRzjWaH8=; b=RuHJP7pHLgk3nrWLqQPpThrqqumWAwsJTlX1d2J1CsgLz0BDwoxcF0CN+Rmi5rfd4Y FfpCtEEajllQIvmBgK8m0vt8YQDVeh7325KYV4zYuKhdIYObYU4jgJAtXegDB5u6Fxny BGO5sLnm89l0I+mvGzRwekDKDr/IPnsPdsWJU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752021695; x=1752626495; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lN7K5g+Sf0Yxb8pRGTAZdG7LE65bww5zRZwGRzjWaH8=; b=cKfvP84kkuo3yJZkfqu9GehSBsox6lae+P8q40FesqEO9Qfp5BpOfTO/IO9jPIzLdd +WU8TAo03M57uW1V34wKB0ntotHXd2KhNL4eII+vD1wp1GXeFX+2bk5YQoRBYHLPIq91 VlVJ+FRMEQJv91sJ/icJ6jSD2T1kv+qqNqCSEyMiM7Mj33ufEM4RhEXZJoa+PR+jtscs uW0dvAperrRnVd8dsY9eBfw+QKQYLnzb9iqXNRhhhWAU1QhaHhaZyDiJhian7khITvaO 8b3A22Yl0rRTgQqr2mRa9DAZm8HzvKrEE1J0sCxsX6fhQmeEtT1UasjOSXbAHFgoItVe fL9g== X-Forwarded-Encrypted: i=1; AJvYcCXq+fMKLtCn+D4P+rIarL1D4xTYZQye7jl3fdZedcjcDWetppHJ16VWhF0iaEHX+q4PJWhJ4DCdHsLwdoxk@lists.postgresql.org X-Gm-Message-State: AOJu0YzeQfe/aXr+CD8Pzx4nc24M1WYGGzBDDcMNMiHxlQkFquTz4fmY wm6F7fBPyh1kKE1UVCs6js9FD6rjL4dd1AHsDkUCqHlY/2nYqNudokn9WvTepALmbg== X-Gm-Gg: ASbGncthrc2woYGC2GTvK8LKVjTuZwiDzATnTzxsPFBLUk/3f0XcfCN5TqZMjS1s8cW 7VwP20fdLIYzWDroAYjwDmRbIpGWeLIWYOE8R0675AY+qdffqMy2gTsRKprOOKhvECdEj1lJmuG gURE7CecdHzLGV+UL1ayVJfHk9u7pffMs1s1I8woOxTI/pgS6eKw6A0Rs5P7Z0rcYyQHgL7MTUD CuTnfgbsl3PuvtSAHTLb4/RUq7EOrW7i1SbHCqybN1SPgCSt1t6erWXr4dv0jK+cLE5tIyp+K0Y uVoHXQVZCLgXwgyjoSQFNkLPlL9r/VF4jXumHQ6OI/7y/1BmUi9JGssdpxKol2hJIMmLvOu4dFs c8mAeZ5PHh07TYCiMxqzNS3HeKg== X-Google-Smtp-Source: AGHT+IHuGkkzUSOlFsxAgqazkVvTGS7KK1LhUmIrY1sJl7OCbeX4Izyl6kmx/2UZhqekEFPit8PzkQ== X-Received: by 2002:a05:6a00:1911:b0:74c:efae:ff6b with SMTP id d2e1a72fcca58-74ea6444467mr1081352b3a.7.1752021695078; Tue, 08 Jul 2025 17:41:35 -0700 (PDT) Received: from google.com (c-76-132-193-99.hsd1.ca.comcast.net. [76.132.193.99]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-74ce43d4f1asm12605442b3a.161.2025.07.08.17.41.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jul 2025 17:41:34 -0700 (PDT) Date: Tue, 8 Jul 2025 17:41:32 -0700 From: Noah Misch To: Michael Paquier Cc: Michael Banck , Greg Sabino Mullane , PostgreSQL Hackers Subject: Re: [PATCH] Add support for displaying database service in psql prompt Message-ID: <20250709004132.db.nmisch@google.com> References: <6748cfd4.050a0220.1537dc.43bb@mx.google.com> <6760a25e.a70a0220.2e9d8f.d542@mx.google.com> <6761397c.df0a0220.68885.210d@mx.google.com> <20250706161319.c1.nmisch@google.com> <20250707030009.b8.nmisch@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jul 08, 2025 at 08:52:08AM +0900, Michael Paquier wrote: > On Sun, Jul 06, 2025 at 08:00:09PM -0700, Noah Misch wrote: > > I think the choice to make there is whether to call PQconninfo() once per > > prompt emission or to cache the value, invalidating that cache e.g. once per > > SyncVariables(). My first thought was to cache, but the decision is not too > > important. A PQconninfo() call is likely negligible relative to all that > > happens between prompts. Even if not negligible, the overhead of not caching > > will affect only prompts using the new escape sequence. > > SyncVariables() happens at startup and when re-syncing a connection > during a check, so that does not really worry me. > > By the way, there is a second change in the CF that's suggesting the > addition of a SERVICEFILE variable, which also uses a separate libpq > API (forgot about this one): > https://commitfest.postgresql.org/patch/5387/ > > Changing the patch on the other thread to use a conninfo is > stright-forward. How about extending the get_service_name()@common.c > I've proposed upthread so as it takes a string in input and it could > be reused for more connection options than only "service" so as it > could be reused there as well? I'd prefer not to get involved in decisions affecting only psql efficiency and psql code cosmetics. Please make that decision without my input.