Skip site navigation (1) Skip section navigation (2)

pgsql: Repair a longstanding bug in CLUSTER and the rewriting variants

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Repair a longstanding bug in CLUSTER and the rewriting variants
Date: 2009-02-24 01:39:10
Message-ID: 20090224013910.BDBF67559ED@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Repair a longstanding bug in CLUSTER and the rewriting variants of ALTER
TABLE: if the command is executed by someone other than the table owner (eg,
a superuser) and the table has a toast table, the toast table's pg_type row
ends up with the wrong typowner, ie, the command issuer not the table owner.
This is quite harmless for most purposes, since no interesting permissions
checks consult the pg_type row.  However, it could lead to unexpected failures
if one later tries to drop the role that issued the command (in 8.1 or 8.2),
or strange warnings from pg_dump afterwards (in 8.3 and up, which will allow
the DROP ROLE because we don't create a "redundant" owner dependency for table
rowtypes).  Problem identified by Cott Lang.

Back-patch to 8.1.  The problem is actually far older --- the CLUSTER variant
can be demonstrated in 7.0 --- but it's mostly cosmetic before 8.1 because we
didn't track ownership dependencies before 8.1.  Also, fixing it before 8.1
would require changing the call signature of heap_create_with_catalog(), which
seems to carry a nontrivial risk of breaking add-on modules.

Tags:
----
REL8_1_STABLE

Modified Files:
--------------
    pgsql/src/backend/catalog:
        heap.c (r1.292.2.2 -> r1.292.2.3)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/heap.c?r1=1.292.2.2&r2=1.292.2.3)
        pg_type.c (r1.104 -> r1.104.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/pg_type.c?r1=1.104&r2=1.104.2.1)
    pgsql/src/backend/commands:
        functioncmds.c (r1.69 -> r1.69.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/functioncmds.c?r1=1.69&r2=1.69.2.1)
        typecmds.c (r1.82.2.2 -> r1.82.2.3)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/typecmds.c?r1=1.82.2.2&r2=1.82.2.3)
    pgsql/src/include/catalog:
        pg_type.h (r1.166.2.1 -> r1.166.2.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_type.h?r1=1.166.2.1&r2=1.166.2.2)

pgsql-committers by date

Next:From: User FxjrDate: 2009-02-24 04:41:32
Subject: npgsql - Npgsql2: Updated for 2.0.3 release
Previous:From: Tom LaneDate: 2009-02-24 01:39:01
Subject: pgsql: Repair a longstanding bug in CLUSTER and the rewriting variants

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group