]> granicus.if.org Git - postgresql/commit
Modify find_inheritance_children() and find_all_inheritors() to add the
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 12 May 2009 03:11:02 +0000 (03:11 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 12 May 2009 03:11:02 +0000 (03:11 +0000)
commitd4a363cdf2b426bbf6c401543b8286ad86ca9bd5
tree6e779dda4f07d302085cf4521c8385cbd241babf
parent0ada559187d167fceb0ce438f332fd50852d0c13
Modify find_inheritance_children() and find_all_inheritors() to add the
ability to lock relations as they scan pg_inherits, and to ignore any
relations that have disappeared by the time we get lock on them.  This
makes uses of these functions safe against concurrent DROP operations
on child tables: we will effectively ignore any just-dropped child,
rather than possibly throwing an error as in recent bug report from
Thomas Johansson (and similar past complaints).  The behavior should
not change otherwise, since the code was acquiring those same locks
anyway, just a little bit later.

An exception is LockTableCommand(), which is still behaving unsafely;
but that seems to require some more discussion before we change it.
src/backend/catalog/pg_inherits.c
src/backend/commands/lockcmds.c
src/backend/commands/tablecmds.c
src/backend/optimizer/prep/prepunion.c
src/backend/parser/parse_coerce.c
src/include/catalog/pg_inherits.h
src/include/catalog/pg_inherits_fn.h [new file with mode: 0644]