pgsql: Modify find_inheritance_children() and find_all_inheritors() to - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Modify find_inheritance_children() and find_all_inheritors() to
Date
Msg-id 20090512031102.3D0EC754067@cvs.postgresql.org
Whole thread Raw
List 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)

pgsql-committers by date:

Previous
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Do some minor code refactoring in preparation for changing the
Next
From: bmomjian@pgfoundry.org (User Bmomjian)
Date:
Subject: pg-migrator - pg_migrator: All only a single username for both clusters.