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.96) (envelope-from ) id 1vnfy7-00A8ql-0o for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Feb 2026 16:43:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vnfy5-00CdKZ-0R for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Feb 2026 16:43:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vnfy4-00CdKQ-2h for pgsql-hackers@lists.postgresql.org; Wed, 04 Feb 2026 16:43:04 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vnfy2-00000000YGs-1iH6 for pgsql-hackers@postgresql.org; Wed, 04 Feb 2026 16:43:03 +0000 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-7d122733808so2927362a34.2 for ; Wed, 04 Feb 2026 08:43:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770223381; x=1770828181; darn=postgresql.org; h=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=IHABxtu40IG6TaPTwRT7vpjsh7o8JQEAdQIoi0TDNzk=; b=OjF1VAXJ1QcDqCP7Pxewilnu48+L7+hgd8PFBviST8LwH/C1VL7LQVPrRdDu5bF+gZ LFPazzD6RUiiKVtL9uOCaEXBcxhyL+LIk6n+2Pm7AX+d+sZKbX6WA8ZYWkDnVLCvwnub +Jug4hIK7pqc/0AzHf3pS9ZahMEvrcr0Y5abePtEjZnlKW1P5QfTm9r9kGgvns9WuNWg UxtZneA+SyQ6UQ9XshbdnVQtvWtkJp3TZ5rZwGEmbkl2aT/iKmfS6w2xUqLFY3/I478A k7/nX36xO/v40T9v2wiPOD4WI6LDDnBf7zaX2q40JTZ2tEfld2SCS5VGRTWnOMl/O4Hm 5PUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770223381; x=1770828181; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IHABxtu40IG6TaPTwRT7vpjsh7o8JQEAdQIoi0TDNzk=; b=Cg33j44Ftis2TsSwZtd+/U8vpXg7l5tzex1EOrH7ArEqu+YOUuPGjdiAjl2qkSGLe4 itnTyBc3S50dL9ZWehCIxsPser78sdjRnRNO0u1AmBWiCkrwVoVh2Cqn+JdoclYb7x+p 7fiWI9s5+EKE0IEb0BpmnIau263SLk8OJKpz5nHrXIQWY/vBnqSLB7yHNqZPWAm2h5Em e76myrGdThhBWnzt730rDfK60kx+y9pZ80ok4TFLB3pSbz/ncEwPS75Nvz+0CpCAi6zH GMCn3bdBUfnCSppRL6fbBi7XvqSIsw7j9+mqR4M/HdgzuQ82asW/ZjpFVbZbC6OmCmQW /tKQ== X-Forwarded-Encrypted: i=1; AJvYcCWr4nveUa6XWpwGbTHzycIqrGzEYUEDrhieRpKVKzLzC7QHfgFCxQYDx1W2adghxQ6uONqUKsLtsAU7QNiT@postgresql.org X-Gm-Message-State: AOJu0Yz1ha5EJ5kN0x8zglN9e+Qm/h3BdQLwdpwrhCQS5jxz9I0pgDg5 MTG5JXXcdRGxvTXd6xdLoPHCYpfNRIkpr8K53tabVdxISm+5xQ2IwXNS X-Gm-Gg: AZuq6aLQ/4SYi/eIA/lhSs5ExEIj2+lLrY3QR00y7pEJIwOY4W8uEpctxuqJOF8TPKY WTDCtLg34hxIWUyiZm3tX3aq5FAfSLDh1YrmamH2QQHXP1xdGTWQUctHipPSwrA5ChLcMmzYJix /QEUSisLGytH7g/s85zSdVgUe7fJPw34pktfs2H233tgqZLnP3rdugbarhhXY7g0s6imJJLRvuN IL8uoQ0LxIAadeoJ3sDPNmYr5p/NRkUPIBG7a0HaKhsDqEvhbaex+THQTlAruyh+zViVC0ZFelN rg31wdIAtovjvMa8gWMNN5F3ZWRSX0yhwwfv3Cfy+LxtxWD+t8gLoCeCll106zIO1eJRradB1Zc 8b/XX0ZIwO2RdEBq20mM13xS2S10p8QSkDF08421PLOGwiCeOjXKPPn+EskJM7sW35pxa/PpO4Y QgisAV2iuXnUPO559eKjpVQLygVwVRJAJAaUCP0XNtjEzKtnC4VjRKi+jvfYrAA+qVVdzrC4DGf LxBzePIrsCuzak= X-Received: by 2002:a05:6830:d0a:b0:7d1:94d0:e8f1 with SMTP id 46e09a7af769-7d4489f3a63mr1936890a34.15.1770223381488; Wed, 04 Feb 2026 08:43:01 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7d4491ffb19sm1956075a34.18.2026.02.04.08.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Feb 2026 08:43:00 -0800 (PST) Date: Wed, 4 Feb 2026 10:42:59 -0600 From: Nathan Bossart To: Peter Eisentraut Cc: Gilles Darold , Zsolt Parragi , Japin Li , Yuefei Shi , songjinzhou , PostgreSQL Hackers , Andrew Dunstan , Tom Lane , liu xiaohui , Steven Niu Subject: Re: Pasword expiration warning Message-ID: References: <197512e0-8116-4776-a600-822d29ee68a6@darold.net> <1f4d0b80-3fea-4f4d-8d33-a652ea23e90b@eisentraut.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1f4d0b80-3fea-4f4d-8d33-a652ea23e90b@eisentraut.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Feb 04, 2026 at 03:44:05PM +0100, Peter Eisentraut wrote: > On 03.02.26 16:28, Nathan Bossart wrote: >> + detail = psprintf(_("The password for role \"%s\" will expire in " >> + INT64_FORMAT " day(s), " INT64_FORMAT >> + " hour(s), " INT64_FORMAT " minute(s)."), >> + role, days, hours, minutes); > > You cannot use INT64_FORMAT inside translatable messages. But you can use > PRId64. Ah, I didn't know that. Is this documented anywhere? I skimmed through our message-writing guidelines [0] but didn't see any mention of this. > Using the type TimestampTz for what are essentially interval/duration > quantities is a bit weird and confusing. So maybe another placeholder would > be more appropriate. Sure. > That said, I find writing plurals with "(s)" kind of lame. It's not a good > look. > > It's a bit difficult to do this correctly when you have three separate > values in one string. I would consider for example just showing the number > of days if the value is larger than one day, number hours if it's larger > than one hour, else minutes. I don't think you need minute-precision when > the expiration time is several days out. I think we still have the problem with plurals if we go this route, and IIUC there isn't a good way to do something like errmsg_plural() here since we are just saving the message for later. I'm skeptical it's worth adding new translatable-plural handling functionality for this. > Alternatively, just print the actual expiration timestamp. That crossed my mind, but I worried about timezone/formatting questions, and I haven't found any examples of putting a timestamp in an error message like this. Is it acceptable to use pg_strftime() in a translated string? [0] https://www.postgresql.org/docs/devel/nls-programmer.html#NLS-GUIDELINES -- nathan