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 1wUGz0-0013AF-2l for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jun 2026 04:44: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 1wUGyy-00CeLG-1F for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jun 2026 04:44:04 +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.96) (envelope-from ) id 1wUGyy-00CeL7-0A for pgsql-hackers@lists.postgresql.org; Tue, 02 Jun 2026 04:44:04 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wUGyw-00000000n9A-0KtU for pgsql-hackers@lists.postgresql.org; Tue, 02 Jun 2026 04:44:03 +0000 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-36bcf3d2565so2122397a91.3 for ; Mon, 01 Jun 2026 21:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780375439; x=1780980239; darn=lists.postgresql.org; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=SjhrYRMp0D2RDZwu/EvIW2Xg7G96KuuAPBlhmNrRUyE=; b=iGoQbpIAEciV2tGsI0TiGNnKZ3kqBpR4Iz8N1pdYkWDYJp9Wd5BY24nG4tuWjhroTR 0JkQhXWxMBX1MzAwcFcAh51SEqq9AsvBLk0OTn0uApCGqXleC01jCwXQvPATg7sbMgb1 hSXPZpO0zoLD0Vcq5liwt4Q1LzAu/FGxhb078xBBAJJyBNKgeA8L6Wp9SRHrt59YxSD+ seHTxswegJKaDTcppQe/KZNM7OVQWmRz3RxaKMYN9RSrq7y3zqCoD49PRC9YPA6uaV6H 5tZj/76Qtgx2saGWBa4df3rcNoDKealhkgMgBDjKRQvhS9uzw0AMP8yreC4FeQxP6HFj kwdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780375439; x=1780980239; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SjhrYRMp0D2RDZwu/EvIW2Xg7G96KuuAPBlhmNrRUyE=; b=Bn+LdaldVfy/cEVaZOmROr9HEIMPgfQ/UtOeXIEVlJxH4p9m4YQz2GOtnal1H9Pv50 9VuKIXQb4wYndqguJvoL8AbAbNLeRttZ0RA4RZrpsGZeRHztgKTvTMYL1HIA2C0UoW40 Y28jmvgQIr4ecAR/DrrAU7OUyW+PZ8htAF0MPDE4C1Jc30dgGSHoSsdzsJVtzHXH3vaA L4p15jQMQDDPE7KybtJtCcr7/RqvPRGznvAsKNYqEblJF8xWMplDmCg81K0devgTtDpz WAcVwP+DvYRoTC7POPkhxREB8qZmSBPQCJxEOaQKJ1wAO8YJp6Ca+2Z3v2H1qB+CVYSf /+Ag== X-Gm-Message-State: AOJu0YyDxPDz1Ww8+1XuU7NZUq1LCOAZgr7fw2GvDz077A6CKekGM5Q7 yzXdu38yjOPjeq4yr26RYQgadStl9mz46zpfWCxhR4V+53eDm8lHAtQ+ X-Gm-Gg: Acq92OGp7dskOp3pO4B6SmUlgCc3QE+LSm36PXqNndWcWKQO1cm2bLB+LJ69FLYwGvv J4GBmpuY1e+A58UvOFpVXPX83iZCyt8FoIW6lcL+Qgb53nmW++8ALn0c2MyqcQ26yRgmLUmYSGk gGpafkbJCfLbJHG654w6hh/7/TcfE7T4ULXVP7/o7Wcy4figN/ebkAEtZbnZ8dbnjxEihOYxkc6 6ikuqCqh2pA2fDIFnR1gND1PQ0YK0tSO+P2GtYUCSNawayCWW2bZ9G4br7dN8I1OfPPWw0ByG79 R7t8zcwjwgCZ48Ms3S5WgRhCB4ygPLMzw2nI3T6DtmemHqASD/mSd6Ij7kLWgUIUfsfxrzc+26S 0oh1q7VnrtlXddW58gTm2cAdYje8EIepfHun7KPNK7XpFTlwHJsYTq3bIbh7RaVBmposEuGcfRF k68L+/++Y5+rHMRd5ezzX6M8LUyGqDQapEchIKYk2l9leGZtR0Jl2Su8tNFbBvY1/GqwIX6AEGN M3VnNfhy61hG/+wKwMn X-Received: by 2002:a17:90a:d60d:b0:36d:7b62:4767 with SMTP id 98e67ed59e1d1-36d7b624c9dmr12460730a91.5.1780375438922; Mon, 01 Jun 2026 21:43:58 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36dd91d06bfsm1561173a91.9.2026.06.01.21.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2026 21:43:57 -0700 (PDT) Date: Tue, 02 Jun 2026 13:43:56 +0900 (JST) Message-Id: <20260602.134356.653346963021072409.horikyota.ntt@gmail.com> To: ashutosh.bapat.oss@gmail.com Cc: pgsql-hackers@lists.postgresql.org Subject: Re: A few message wording/formatting cleanup patches From: Kyotaro Horiguchi In-Reply-To: References: <20260528.121622.1662808269492494574.horikyota.ntt@gmail.com> User-Agent: Mew version 6.8 on Emacs 29.4 Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Tue_Jun__2_13_43_56_2026_572)--" Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ----Next_Part(Tue_Jun__2_13_43_56_2026_572)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello. Thank you for the comments. At Mon, 1 Jun 2026 17:18:13 +0530, Ashutosh Bapat wrote in > 1. There are other places in the function where we use similar code. > Those places call initStringInfo just before getRelationDescription() > is called and then pfree() StringInfoData.data after it is added to > the object description. That's a good point. I hadn't paid much attention to that because the allocation is short-lived, but matching the surrounding code is probably better. I've added pfree() in the attached patch. > 2. Why do we want to capture the output of getObjectDescription() in a > StringInfo and then add it to the buffer? I think we can pass > getObjectDescription directly as an argument to appendStringInfo() > similar to the code for case AttrDefaultRelationId. I considered returning strings from helper functions such as getRelationDescription(), but that would affect a number of similar helper functions and broaden the scope of the patch. While working on this, I noticed that the string returned by getObjectDescription() in the AttrDefaultRelationId case is not pfree'd. Since that appears unrelated to this patch, I left it as-is. I also dropped the assertions on the temporary description strings. They were mainly there while developing the patch and don't seem necessary in the final version. Thanks! -- Kyotaro Horiguchi NTT Open Source Software Center ----Next_Part(Tue_Jun__2_13_43_56_2026_572)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v2-0001-Make-propgraph-object-descriptions-translatable.patch" From e8f0a3f18fa052fd0ff2d7fc51ac23401021d8f1 Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi Date: Tue, 2 Jun 2026 12:07:58 +0900 Subject: [PATCH v2] Make propgraph object descriptions translatable getObjectDescription() currently constructs propgraph-related object descriptions incrementally with appendStringInfo(). This effectively fixes the word order in English, which makes the messages difficult to translate naturally into languages such as Japanese. --- src/backend/catalog/objectaddress.c | 56 +++++++++++++++++++---------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c index 050b7829eb0..9eb574f5ccc 100644 --- a/src/backend/catalog/objectaddress.c +++ b/src/backend/catalog/objectaddress.c @@ -4077,6 +4077,9 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok) { HeapTuple tup; Form_pg_propgraph_element pgeform; + StringInfoData objdesc; + + initStringInfo(&objdesc); tup = SearchSysCache1(PROPGRAPHELOID, ObjectIdGetDatum(object->objectId)); if (!HeapTupleIsValid(tup)) @@ -4089,16 +4092,16 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok) pgeform = (Form_pg_propgraph_element) GETSTRUCT(tup); + getRelationDescription(&objdesc, pgeform->pgepgid, false); + if (pgeform->pgekind == PGEKIND_VERTEX) - /* translator: followed by, e.g., "property graph %s" */ - appendStringInfo(&buffer, _("vertex %s of "), NameStr(pgeform->pgealias)); + appendStringInfo(&buffer, _("vertex %s of %s"), NameStr(pgeform->pgealias), objdesc.data); else if (pgeform->pgekind == PGEKIND_EDGE) - /* translator: followed by, e.g., "property graph %s" */ - appendStringInfo(&buffer, _("edge %s of "), NameStr(pgeform->pgealias)); + appendStringInfo(&buffer, _("edge %s of %s"), NameStr(pgeform->pgealias), objdesc.data); else - appendStringInfo(&buffer, "??? element %s of ", NameStr(pgeform->pgealias)); - getRelationDescription(&buffer, pgeform->pgepgid, false); + appendStringInfo(&buffer, "??? element %s of %s", NameStr(pgeform->pgealias), objdesc.data); + pfree(objdesc.data); ReleaseSysCache(tup); break; } @@ -4109,6 +4112,7 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok) HeapTuple tuple; Form_pg_propgraph_element_label pgelform; ObjectAddress oa; + char *objdesc; rel = table_open(PropgraphElementLabelRelationId, AccessShareLock); tuple = get_catalog_object_by_oid(rel, @@ -4125,10 +4129,13 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok) pgelform = (Form_pg_propgraph_element_label) GETSTRUCT(tuple); - appendStringInfo(&buffer, _("label %s of "), get_propgraph_label_name(pgelform->pgellabelid)); - ObjectAddressSet(oa, PropgraphElementRelationId, pgelform->pgelelid); - appendStringInfoString(&buffer, getObjectDescription(&oa, false)); + ObjectAddressSet(oa, PropgraphElementRelationId, + pgelform->pgelelid); + objdesc = getObjectDescription(&oa, false); + appendStringInfo(&buffer, _("label %s of %s"), get_propgraph_label_name(pgelform->pgellabelid), objdesc); + + pfree(objdesc); table_close(rel, AccessShareLock); break; } @@ -4137,6 +4144,9 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok) { HeapTuple tuple; Form_pg_propgraph_label pglform; + StringInfoData objdesc; + + initStringInfo(&objdesc); tuple = SearchSysCache1(PROPGRAPHLABELOID, ObjectIdGetDatum(object->objectId)); if (!HeapTupleIsValid(tuple)) @@ -4148,9 +4158,11 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok) pglform = (Form_pg_propgraph_label) GETSTRUCT(tuple); - /* translator: followed by, e.g., "property graph %s" */ - appendStringInfo(&buffer, _("label %s of "), NameStr(pglform->pgllabel)); - getRelationDescription(&buffer, pglform->pglpgid, false); + getRelationDescription(&objdesc, pglform->pglpgid, false); + + appendStringInfo(&buffer, _("label %s of %s"), NameStr(pglform->pgllabel), objdesc.data); + + pfree(objdesc.data); ReleaseSysCache(tuple); break; } @@ -4161,6 +4173,7 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok) HeapTuple tuple; Form_pg_propgraph_label_property plpform; ObjectAddress oa; + char *objdesc; rel = table_open(PropgraphLabelPropertyRelationId, AccessShareLock); tuple = get_catalog_object_by_oid(rel, @@ -4177,10 +4190,13 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok) plpform = (Form_pg_propgraph_label_property) GETSTRUCT(tuple); - appendStringInfo(&buffer, _("property %s of "), get_propgraph_property_name(plpform->plppropid)); - ObjectAddressSet(oa, PropgraphElementLabelRelationId, plpform->plpellabelid); - appendStringInfoString(&buffer, getObjectDescription(&oa, false)); + ObjectAddressSet(oa, PropgraphElementLabelRelationId, + plpform->plpellabelid); + objdesc = getObjectDescription(&oa, false); + appendStringInfo(&buffer, _("property %s of %s"), get_propgraph_property_name(plpform->plppropid), objdesc); + + pfree(objdesc); table_close(rel, AccessShareLock); break; } @@ -4189,6 +4205,9 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok) { HeapTuple tuple; Form_pg_propgraph_property pgpform; + StringInfoData objdesc; + + initStringInfo(&objdesc); tuple = SearchSysCache1(PROPGRAPHPROPOID, ObjectIdGetDatum(object->objectId)); if (!HeapTupleIsValid(tuple)) @@ -4200,9 +4219,10 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok) pgpform = (Form_pg_propgraph_property) GETSTRUCT(tuple); - /* translator: followed by, e.g., "property graph %s" */ - appendStringInfo(&buffer, _("property %s of "), NameStr(pgpform->pgpname)); - getRelationDescription(&buffer, pgpform->pgppgid, false); + getRelationDescription(&objdesc, pgpform->pgppgid, false); + + appendStringInfo(&buffer, _("property %s of %s"), NameStr(pgpform->pgpname), objdesc.data); + pfree(objdesc.data); ReleaseSysCache(tuple); break; } -- 2.52.0 ----Next_Part(Tue_Jun__2_13_43_56_2026_572)----