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 1vujbL-003lKy-2L for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 04:00:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vujbJ-00Gpem-2Q for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 04:00:45 +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 1vujbJ-00Gped-1U for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 04:00:45 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vujbG-00000000yP7-1Bnq for pgsql-hackers@postgresql.org; Tue, 24 Feb 2026 04:00:45 +0000 Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-c2af7d09533so3358041a12.1 for ; Mon, 23 Feb 2026 20:00:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771905641; x=1772510441; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0XZq62BVJb1sSDDt4P+VR9eiS6BTopoXRGemSNhLsXY=; b=JvZyWVKASw5qb5W4oE9QJ7cOgBALFGJ409Zy+RvDdL/qFBmjTQCXl/UaE88T8kVAXc vkCcmOTwgjhdpnGisv2WZhUR2cDlfSFNuTIuyGrtMrHoSGlpq/JSjZnxH09YLDWuPyhI PEBPTQhLtYhNVpuTZvbqA2WwDd1/h0lwlpG8G4SB+LgYtwGsZm/iH5k3DuHdR5mhnT+V 4KgzuO05XU0LEs83+ZOk7cRFSH0TyRVBrDfpndMr1CjObbFPueD6EF1MH+EUoeC+4LoV INi/6DP/uNxoAAyNrRzhdzHU+EndfNCTzCIWfXuOCJo2e0beJYqW0EXhjY4jwTareYj2 gJCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771905641; x=1772510441; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=0XZq62BVJb1sSDDt4P+VR9eiS6BTopoXRGemSNhLsXY=; b=hGCo+6Gis+KG5fbe/i1RF8X8vAWGiJRdcd+MM88TnxyJYhZ4fqxp3UBK0otpiHnOKN pSTeojCwPKh4fKS7CX5Q2p1+s8dyhh1UteO9esaR4ixSHlPGrfQD9nzJBvEOTYfBqc2a Gf3xwZTPSDTWh1P7OzoFAlzyWEnS0BVUr+eEEKh3QuIUwRztAYzXWD9FmOlU732ezvjh 5hTju4VxtsDDv4oqft6e+MEgChA+Lc2ACtmITuPJQKa7gknBERvlZCpU7mA+c8Bbr8Nz iILWP3zu8mFTYNjjGhMR/x/icPl7qwiFaZAaUzrMQBhz7My6VzLMAJllG/j/1uLYinX7 TGcQ== X-Forwarded-Encrypted: i=1; AJvYcCVK2/1xOzQIfGFurAZagcUC3F3whYu3QW3VP+yMUBuaAkk6JO3VjL1yDJTGDBdYuSLSskk9VBBhIUPeQgTJ@postgresql.org X-Gm-Message-State: AOJu0Ywf/k53x/kQrm2dukg62Xwd5VMIsyi83lY3SSz7pMLu2uPir1Ut qPYLrTisSyGslR7DFe/OANpIligqO2QxnfhxQ07pj4QaJa0AbanY1bN8 X-Gm-Gg: AZuq6aJeWGjQdBi9u2a/OS7mx7dUXCO/oVkGnfQeJh8Hvhzx5L5WQMXDlcq1n0279Bw C0isq287iuQ/5QY/ss/9CZXtjgwLTbE5yG0gHLRq/oymUNE7A4X/vLhAtnfQgmoeNFA7pUOU8qs 49s8mWUcwpMyTvUlPZ04DFGG1lQJmkGm2lhPr69I3Cq9IsH0Bw5fJvtdx3UeWoA+JIsD0MPVgCK czIWHIfzQwjK+37nPWJr3DLveu9Mg0+yXQ5IyZ+PHXyboxFLUuum3HaVGQCnuMYuNdk8Z/FuKnA iPKNIsCPQ2LnQ0JvYvafUawqp5E6KKzFVco+8LSmd13Czc/v0qM0180Mq10ismeGe+M9TttsXqb 5AwLemwHeN7FQG8TNENsPmHY3r1QB7eTkvXMm0aqaUNVSl9mg/ETJng7cIIToG1eOuM40VC40P3 Wl/PZXwQU+4qIu1MkPKXExutMdhtToiQ== X-Received: by 2002:a05:6a20:c989:b0:342:352c:77e5 with SMTP id adf61e73a8af0-39545fc99c3mr11477568637.54.1771905640850; Mon, 23 Feb 2026 20:00:40 -0800 (PST) Received: from smtpclient.apple ([203.10.98.27]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-826dd86c5ccsm9212961b3a.35.2026.02.23.20.00.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Feb 2026 20:00:40 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: Propagate XLogFindNextRecord error to callers From: Chao Li In-Reply-To: Date: Tue, 24 Feb 2026 12:00:05 +0800 Cc: Mircea Cadariu , PostgreSQL Hackers , Japin Li Content-Transfer-Encoding: quoted-printable Message-Id: <1D505B52-9D58-4783-846D-600391C2A3B1@gmail.com> References: <0cbf5d34-f117-456f-bcc0-50fa9a8eafba@gmail.com> To: Anthonin Bonnefoy X-Mailer: Apple Mail (2.3864.300.41.1.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Feb 12, 2026, at 15:43, Anthonin Bonnefoy = wrote: >=20 > On Wed, Feb 11, 2026 at 1:16=E2=80=AFPM Mircea Cadariu = wrote: >> Indeed. Should we place this initialisation at the top of >> XLogFindNextRecord, before any processing? At that point, there's >> nothing to erase. >=20 > That makes sense, I've added the '*errormsg =3D NULL' at the top of = the function. >=20 >> You can consider capitalising. >=20 > Done > Hi Anthonin, Thanks for the patch. I agree it=E2=80=99s useful to print a more = detailed error message instead of the generic one. =46rom a design perspective, I=E2=80=99m not sure we need to add a new = errormsg parameter to XLogFindNextRecord(). The new parameter ultimately = just exposes state->errormsg_buf, so the returned errormsg implicitly = depends on the lifetime of state, and we also need extra handling for = cases like errormsg =3D=3D NULL. Instead, perhaps we could add a helper function, say = XLogReaderGetLastError(XLogReaderState *state). which internally = pstrdup()s state->errormsg_buf (after checking errormsg_deferred, etc.). = That way the caller owns the returned string explicitly, and there=E2=80=99= s no hidden dependency on the reader state=E2=80=99s lifetime. This would also avoid changing the XLogFindNextRecord() signature while = making the ownership semantics clearer. What do you think? Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/