Skip to content

Commit 6da3b76

Browse files
committed
Add some notes about memory management of RI plans.
1 parent db3ac67 commit 6da3b76

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/backend/utils/adt/ri_triggers.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,21 @@
44
* Generic trigger procedures for referential integrity constraint
55
* checks.
66
*
7-
* 1999 Jan Wieck
7+
* Note about memory management: the private hashtables kept here live
8+
* across query and transaction boundaries, in fact they live as long as
9+
* the backend does. This works because the hashtable structures
10+
* themselves are allocated by dynahash.c in its permanent DynaHashCxt,
11+
* and the parse/plan node trees they point to are copied into
12+
* TopMemoryContext using SPI_saveplan(). This is pretty ugly, since there
13+
* is no way to free a no-longer-needed plan tree, but then again we don't
14+
* yet have any bookkeeping that would allow us to detect that a plan isn't
15+
* needed anymore. Improve it someday.
816
*
9-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.20 2000/12/22 18:35:09 tgl Exp $
17+
*
18+
* Portions Copyright (c) 2000-2001, PostgreSQL Global Development Group
19+
* Copyright 1999 Jan Wieck
20+
*
21+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.21 2001/02/15 21:57:43 tgl Exp $
1022
*
1123
* ----------
1224
*/

0 commit comments

Comments
 (0)