pgsql: Modify find_inheritance_children() and find_all_inheritors() to

Lists: pgsql-committers
From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Modify find_inheritance_children() and find_all_inheritors() to
Date: 2009-05-12 03:11:02
Message-ID: 20090512031102.3D0EC754067@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Log Message:
-----------
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.

Modified Files:
--------------
pgsql/src/backend/catalog:
pg_inherits.c (r1.1 -> r1.2)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/pg_inherits.c?r1=1.1&r2=1.2)
pgsql/src/backend/commands:
lockcmds.c (r1.22 -> r1.23)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/lockcmds.c?r1=1.22&r2=1.23)
tablecmds.c (r1.283 -> r1.284)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c?r1=1.283&r2=1.284)
pgsql/src/backend/optimizer/prep:
prepunion.c (r1.169 -> r1.170)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/prep/prepunion.c?r1=1.169&r2=1.170)
pgsql/src/backend/parser:
parse_coerce.c (r2.175 -> r2.176)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_coerce.c?r1=2.175&r2=2.176)
pgsql/src/include/catalog:
pg_inherits.h (r1.27 -> r1.28)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_inherits.h?r1=1.27&r2=1.28)

Added Files:
-----------
pgsql/src/include/catalog:
pg_inherits_fn.h (r1.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_inherits_fn.h?rev=1.1&content-type=text/x-cvsweb-markup)