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 1wDF6n-002luA-1z for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Apr 2026 05:17:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wDF6m-003vDD-2t for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Apr 2026 05:17:44 +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 1wDF6m-003vCs-1z for pgsql-hackers@lists.postgresql.org; Thu, 16 Apr 2026 05:17:44 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wDF6k-00000001Lwd-21IM for pgsql-hackers@lists.postgresql.org; Thu, 16 Apr 2026 05:17:44 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-82748257f5fso141431b3a.1 for ; Wed, 15 Apr 2026 22:17:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776316660; cv=none; d=google.com; s=arc-20240605; b=FooDeY/P+DDNK//Id0ysHhMDfoWkTKcz2H0G2o5W6LCVWKfg4Nd9t+ebcyCBCYojNd vGHWI85gz3GQVz7OxQxihOqIL5FJUt1x0HIL2oAR5yiq2bmQnZd+HfTlmGcA4cp94NZr HmEpiWueV/ohLrxtmw9H8EyERi8C66kTGZgvJ5D2+QAjOrZic2kz33G3FBxnd0+LTONn 66jQrUL576c2zBjTJi5nrS532AR9IpWWYkeL+sYRWjiFi7MUWm9eItqeBhI0cKieTMh2 6dUURl+itwqDWKqaxdKCpHPXPabuxg1/SIcRqMF7EIg/6UzAgCG5ubQu3KSBd+ONvkaH VFLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=B53KAa5m2nKnJsGSy5A6CSqwAYWKx58SC9WGmG3mpqw=; fh=kLGR4amf7hmWe9E8HOJca9NJ3NnGiOjRL2Sp+Xdvy18=; b=Vgy2aJ8Gy8aJZ6BCuArMaIy5M1MH0UmhdZrChb6kqJgLHwA3KyX7Eo9Joct3ab16VM 2EWQO4Da+2JDosV20xEq+PDB5w7msrQLUmrhiP01M28TX6zMtZJ07unupkopE2YWkXkE iiYA/y3y0z1vn8lwUFM0j9I//MwC3RLVHHLXBIMrsj4BseJX5xz6sRn1vkp60iVIbL8U k0kHet4V5BrUxH0Lt7m7+c30v1YrOMXqB3hE6x7CQccoDqtvwwR1slesi2a5si5GYp2n ODNXaTqdwYP/PUFlauIdQNIX0gg8wcZFyJLKGMTJekevUquIvWieAUZqBKH8pOktQD+T dMQA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776316660; x=1776921460; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=B53KAa5m2nKnJsGSy5A6CSqwAYWKx58SC9WGmG3mpqw=; b=eZTT8ZNSX/JEvUZvSxELnIOC2yoKwzIWhA+JRaPo8I1SVpjan4IYsBySBpIOI/hj8r dibh9GxSYmhzwg66YF+hq9hInAcYunJffcdisnXhFPxKosRhzlONip72mPg1bZwoRdiH uwULA5GibwwmvIS6myJ5IfWedUsBk/0Z/6Sl/OF2zSsDmY2FUvCmZmpaTbGzTLUXrBiZ jIZX+AbF/EMNRTm8PSz/vNVmQbpOikwdBjWOikWSgDThavvUxcm1LX8bmqpT8ye1Hhb8 41o8pxTHhElT/ZwZ4woyTY6FAb+zB+GOTBErc8vIAokEg9ZUd/02AFn6+uirtVUbHx86 /vxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776316660; x=1776921460; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=B53KAa5m2nKnJsGSy5A6CSqwAYWKx58SC9WGmG3mpqw=; b=P3huZZ0SSKrJ+MsuWa74BxEvHFCyp3Xz2A1dvhJVDWwFpkmmr8+Iw+hCrvg5veLfn8 WyZMiH6YqaBZbQu7oq/11PjBNfAS+CbH3zT7X7nZ8Y3CqTlPAqodRNsp9zcclqdcXuYr VV8aQ1haNSDlP4NXIbNtvmLSJsHiqQK16cmx+KAyOAaq+tOoCB4OuktcMR3NSAestqt0 tDhQp6Ua8Xb15IUTwAUwsUE4fLAivfk+IFcjiP0dUaKyFv2lYzAwwmv8XpLYnA/6BADv rvYDum+pnLRDi4FPnoYPlrqAMAFCKg35qwp/j3lFjHDoL+iyvrPq9W1gYBAX9iBAxQnJ ikyg== X-Forwarded-Encrypted: i=1; AFNElJ+OdbiEVCE3lslcrUQ6hNOUxwCdH7dQaXBfTu767fWFOwsRLK16zThOg/+HlH+BcxKVRNA+wiDYai1a+Rt/@lists.postgresql.org X-Gm-Message-State: AOJu0YwwiLDw++CAA1W3dZSVwt+9/28n7ZKeG17CByTTobC8pNYCxGpk SzNbFyHPka6qP19nQS7QGsstJYmnx6QEp5NUh8bl/KLStHUFwTT/mntiEgdXlgGaRjx8gxy4GpV vUzbzh5QBlbXycl4hfU6hHP/dt7h6HaY= X-Gm-Gg: AeBDies73KEmmpZw1ItRrSxIuWpJWb/PbsuICFF01t4Vo5KSS9zcyekZrsyj0ZeDQZu s5BOTT872qGBEm249OfHYfH+uEvs3n/SW+EmMkEjIL8/dLo6NsY7XYI6FQhftLzSELHI/wHEtV8 XXR2BE/2AMhgvfCQ9IoJTITwgpRdhlTmpF8ik9dlg7mf9cC2JbKhIMRAb7pSnhxPMIPi710wYia 29PsSb5bl6wLtwEcaBAhs+3Fu1iN5nHYp9D1rLPgdf6/iBC1GrTsEIwrKobigGCG/TYt4XyHKXy xR1miPJRU1TQMTFrFgK348alL5RolBlZx4jEx4MTBzetS4ZJR8u0u5GfTkyyLbZz X-Received: by 2002:a05:6a20:6a20:b0:398:76d4:c7e9 with SMTP id adf61e73a8af0-3a06d418d46mr2423698637.35.1776316660549; Wed, 15 Apr 2026 22:17:40 -0700 (PDT) MIME-Version: 1.0 References: <9EE922BD-29B2-40AF-A50E-03D7E89C10DB@gmail.com> In-Reply-To: From: Amit Langote Date: Thu, 16 Apr 2026 14:17:22 +0900 X-Gm-Features: AQROBzAS-znaVmaD5xtf61Qt4cqKZYGm6hoIZGHIIxLbQdtbqvOlme_ANjoPr7w Message-ID: Subject: Re: [PATCH] Fix wrong comment in JsonTablePlanJoinNextRow() To: Chao Li Cc: =?UTF-8?B?6IOh5Lyg5paH?= <463945512@qq.com>, pgsql-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Apr 16, 2026 at 12:03=E2=80=AFPM Amit Langote wrote: > On Thu, Apr 16, 2026 at 11:05=E2=80=AFAM Chao Li = wrote: > > > On Apr 15, 2026, at 16:28, =E8=83=A1=E4=BC=A0=E6=96=87 <463945512@qq.= com> wrote: > > > > > > Hi, > > > Found a misleading comment in JsonTablePlanJoinNextRow() while readin= g > > > the JSON_TABLE execution code. > > > The function returns false when both siblings are exhausted (meaning = no > > > more rows), but the comment says "there are more rows" =E2=80=94 the = exact > > > opposite of what's happening. The code itself is correct. > > > if (!JsonTablePlanNextRow(planstate->right)) > > > { > > > /* Right sibling ran out of row, so there are more rows. */ /* wrong = */ > > > return false; > > > } > > > A reader might reasonably treat this as a bug and flip the return val= ue, > > > which would cause JSON_TABLE UNION plans to loop indefinitely. > > > Patch attached. > > Thanks for the report and the patch. > > > The fix looks correct to me. I guess =E2=80=9Cno=E2=80=9D was just unin= tentionally missed. > > > > A small comment, I just feel =E2=80=9Ctoo=E2=80=9D you newly added migh= t not be needed. > > Actually, I'd keep it, because it ties the comment to the left-sibling > check just above. > > Will push the attached down to v17. Done. --=20 Thanks, Amit Langote