From 9ffc8ed58b55cb3925bb95cc184583fcb9772013 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 15 Oct 2004 22:40:29 +0000 Subject: Repair possible failure to update hint bits back to disk, per http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php. This fix is intended to be permanent: it moves the responsibility for calling SetBufferCommitInfoNeedsSave() into the tqual.c routines, eliminating the requirement for callers to test whether t_infomask changed. Also, tighten validity checking on buffer IDs in bufmgr.c --- several routines were paranoid about out-of-range shared buffer numbers but not about out-of-range local ones, which seems a tad pointless. --- src/backend/utils/adt/ri_triggers.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/backend/utils/adt/ri_triggers.c') diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index 20ad56c31f1..b195e243393 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -17,7 +17,7 @@ * * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.73 2004/09/13 20:07:13 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.74 2004/10/15 22:40:11 tgl Exp $ * * ---------- */ @@ -224,10 +224,15 @@ RI_FKey_check(PG_FUNCTION_ARGS) * We should not even consider checking the row if it is no longer * valid since it was either deleted (doesn't matter) or updated (in * which case it'll be checked with its final values). + * + * We do not know what buffer the new_row is in, but it doesn't matter + * since it's not possible for a hint-bit update to occur here (the + * new_row could only contain our own XID, and we haven't yet committed + * or aborted...) */ if (new_row) { - if (!HeapTupleSatisfiesItself(new_row->t_data)) + if (!HeapTupleSatisfiesItself(new_row->t_data, InvalidBuffer)) { heap_close(pk_rel, RowShareLock); return PointerGetDatum(NULL); -- cgit v1.2.3