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 1vmlEv-00Fy6o-1x for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Feb 2026 04:08:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vmlEt-00BYFQ-27 for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Feb 2026 04:08:40 +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 1vmlEt-00BYFI-1C for pgsql-hackers@lists.postgresql.org; Mon, 02 Feb 2026 04:08:40 +0000 Received: from mail-dl1-x1235.google.com ([2607:f8b0:4864:20::1235]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vmlEr-00000000bmT-3GMu for pgsql-hackers@lists.postgresql.org; Mon, 02 Feb 2026 04:08:39 +0000 Received: by mail-dl1-x1235.google.com with SMTP id a92af1059eb24-124877d78a6so4677234c88.1 for ; Sun, 01 Feb 2026 20:08:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770005315; x=1770610115; darn=lists.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=yrYee5BjSLZ6Nnlb64PgwfTpXEV0IBrCdVJI3UFqako=; b=amCv+bLFyj9LZ+y3pQQLLiz9oaAmbio5DbPR1s0QNu7Xmo/TxTxGhdY036SuceyBqT hcIHRZsl4eK9sQMj5NClaqCPfwJ5/vlsUnuKmA5VhqjMqW/gwTCca28UgMzk2T0ETk7v 25/uOHr02Lq1EUN7uYWHHaQY7obti23LAz1NNV0q5TE++bmZp9OA3sPRpoMIPWZA+yry l8nEX/PsGg0vATcbydOFP90LQS1V6x42q6rL8wLY5ef5hn8earxTcbI3BWNepr7Ey8Og j4BaI/NUy+9ote6pZqliORhEkkQE0fx+BS0VeOz9NXw0n/uFwj6lw8aUxBj274kUGDQD T6RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770005315; x=1770610115; 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=yrYee5BjSLZ6Nnlb64PgwfTpXEV0IBrCdVJI3UFqako=; b=FK7/uAwB4ZeY/8Jvcp5SXDk8cE58mNUjsoawRv/Mq6tjiddpJ8I7wpXp7Hg1bBkqIm r25twF23hzMvkULh6dqb+1+VFfTpL99ve6QGDxZSOblD0R5tfKaBYrWlr6BHrF7Lnua5 z01niQfZ1g2FR/3PpmV9YsGwFUoZ+ZMypT2sbLzkfVRKBWbgawsk0AvpTmelwQ2PGKQG xm96qxIo4bmBtBPFz65uTScMSBhYc9Ho+/EDSDbHUm5eOG/JWHMIgEtgz5NshNi/xmpM ns8MeKE7wycYMS644W0UFAWiqou++p00e/P7Kp7kZzg4aWua9GXhF1NYSfXJj9BlE0ov r5tw== X-Gm-Message-State: AOJu0YyiqfnAvL8vjDO2HSK+3BD5+U5AM+0SxDUt5g0WY2fXes8lg2c3 wo5WjleB1yEvsxlvpCC/4HlO9QI7AOJU/53VuP/pXgKW69yaobOvdlZ2 X-Gm-Gg: AZuq6aLiEDICBLJAzH8PILbaBiT8jyPUkg4Uj0/jN52W1/wi7I8rPYkyDhjHK4I9yCd lsGGD3F75Gf3wNg4sX4TI9lltQuldpr1VoFwktr0MhZqG3eL5oYEEibPVA/Hm1zdZFRPvVi0N0Y eW9hvqbnqji7o4639ev886cca+NcE1LAU4RpXwbatdo9L4Vvu+Au+Q98wJD6ldsXcmAwS+mvYhn vugibemmp9FQJrkqUAXPgV2Z9SDBvP2mYdsYkHwXdEHjjzjKPGqnW/6kv50uQhN1grJXYqlQouF gW+IYOtfSDEsQ8CQcvjFdwxKaDpC8/91am+nBwOwBg9XY1CzmfChzSTOSMjZipIblJ2oWy1QjqU c00TOPE1hmraQvVD8g9hepudPrDV6H5WYw6E0YCKC3UeTv6ApNFpXhdLbId27N3NA63C+cWgDXw 70WYl+u3FvTQKccj55Us6V X-Received: by 2002:a05:7300:8186:b0:2b7:1744:726f with SMTP id 5a478bee46e88-2b7c863a309mr5368662eec.2.1770005315412; Sun, 01 Feb 2026 20:08:35 -0800 (PST) Received: from smtpclient.apple ([142.171.105.12]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b7a1abeb6asm20631636eec.19.2026.02.01.20.08.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Feb 2026 20:08:34 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: Incorrect errno used in OpenWalSummaryFile() From: Chao Li In-Reply-To: Date: Mon, 2 Feb 2026 12:07:57 +0800 Cc: Postgres hackers , Robert Haas Content-Transfer-Encoding: quoted-printable Message-Id: <077771A9-06A7-43E3-ADC8-80DE52C3BB4A@gmail.com> References: To: Michael Paquier 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 2, 2026, at 11:54, Michael Paquier wrote: >=20 > Hi all, >=20 > While looking at walsummary.c for a different thread, I have bumped > into this code: > OpenWalSummaryFile(WalSummaryFile *ws, bool missing_ok) > [...] > file =3D PathNameOpenFile(path, O_RDONLY); > if (file < 0 && (errno !=3D EEXIST || !missing_ok)) > ereport(ERROR, > (errcode_for_file_access(), > errmsg("could not open file \"%s\": %m", path))); >=20 > And it seems to me that this EEXIST should be an ENOENT? The top of > the function also documents that we want to handle an error when a > summary file does not exist. The comment makes sense to me, not the > code. >=20 > It's also worth noting that this function has two callers, both use > missing_ok =3D false, meaning that the errno check does not really > matter today. If someone plays with this code on HEAD or the > back-branches and decides to introduce a missing_ok=3Dtrue call, it > could matter, so I'd rather not change this function signature. >=20 > This issue has been mentioned here as well, I've just bumped into it > independently a few hours ago: > = https://www.postgresql.org/message-id/tencent_1CA40FCC21C1C770712BC089@qq.= com >=20 > Regards, > -- > Michael > I think this is a correct fix. ``` [EEXIST] O_CREAT and O_EXCL are specified and the file exists.=20 [ENOENT] O_CREAT is not set and the named file does not exist. ``` Here, the open flag is only O_RDONLY, so we should only expect ENOENT. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/