]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix invalid value of pg_aios.pid, function pg_get_aios()
authorMichael Paquier <michael@paquier.xyz>
Mon, 23 Mar 2026 09:14:28 +0000 (18:14 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 23 Mar 2026 09:14:28 +0000 (18:14 +0900)
When the value of pg_aios.pid is found to be 0, the function had the
idea to set "nulls" to "false" instead of "true", without setting the
value stored in the tuplestore.  This could lead to the display of buggy
data.  The intention of the code is clearly to display NULL when a PID
of 0 is found, and this commit adjusts the logic to do so.

Issue introduced by 60f566b4f243.

Author: ChangAo Chen <cca5507@qq.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/tencent_7D61A85D6143AD57CA8D8C00DEC541869D06@qq.com
Backpatch-through: 18

src/backend/storage/aio/aio_funcs.c

index d7977387b8f1afe56224d54463bfe78d714e543a..75349ab872ef93769e3d23ff5c34972c6e85a6d4 100644 (file)
@@ -149,7 +149,7 @@ retry:
                if (owner_pid != 0)
                        values[0] = Int32GetDatum(owner_pid);
                else
-                       nulls[0] = false;
+                       nulls[0] = true;
 
                /* column: IO's id */
                values[1] = Int32GetDatum(ioh_id);