Re: [PATCH] Check more invariants during syscache initialization
Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Aleksander Alekseev <aleksander@timescale.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Zhang Mingli
<zmlpostgres@gmail.com>, Michael Paquier <michael@paquier.xyz>
Date: 2023-07-26T14:28:55Z
Lists: pgsql-hackers
Aleksander Alekseev <aleksander@timescale.com> writes: > Hi Zhang, > >> That remind me to have a look other codes, and a grep search `oid != 0` show there are several files using old != 0. >> >> ``` >> .//src/bin/pg_resetwal/pg_resetwal.c: if (set_oid != 0) >> .//src/bin/pg_resetwal/pg_resetwal.c: if (set_oid != 0) >> .//src/bin/pg_dump/pg_backup_tar.c: if (oid != 0) >> .//src/bin/pg_dump/pg_backup_custom.c: while (oid != 0) >> .//src/bin/pg_dump/pg_backup_custom.c: while (oid != 0) >> ``` >> That is another story…I would like provide a patch if it worths. > > Good catch. Please do so. Shouldn't these be calling `OidIsValid(…)`, not comparing directly to `InvalidOid`? ~/src/postgresql (master $)$ git grep '[Oo]id [!=]= 0' | wc -l 18 ~/src/postgresql (master $)$ git grep '[!=]= InvalidOid' | wc -l 296 ~/src/postgresql (master $)$ git grep 'OidIsValid' | wc -l 1462 - ilmari
Commits
-
Add sanity asserts for index OID and attnums during cache init
- f6a84546b1a0 17.0 landed