Re: Fixing invalid owners on pg_toast tables in 8.3.5

From: Cott Lang <cott(at)internetstaff(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Fixing invalid owners on pg_toast tables in 8.3.5
Date: 2009-02-21 00:26:43
Message-ID: 1235176003.3656.57.camel@duo.internetstaff.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2009-02-20 at 16:35 -0500, Tom Lane wrote:

> Can you see any pattern or common characteristic to the tables whose
> toast pg_type rows failed to change owner? I'm not sure what to look
> for exactly, but similarities in the column contents might be a
> possibility. Also, can you tell if the problem tables were adjacent
> in the dump that was restored?

I fiddled around a while, found the problem, and I can repeat it at
will. It's actually related to type changes we've made over the months
since the restore.

Scenario:

1. Create a table as user A.

create table toaster (
bread varchar(8000)
);

2. Check typowner of toast type

# select typowner from pg_type join pg_class on (typname=relname) where
pg_class.oid in (select reltoastrelid from pg_class where
relname='toaster');
typowner
----------
16388

3. Alter the field type

alter table toaster ALTER bread type varchar(9000);

4. Check the typowner of toast type

# select typowner from pg_type join pg_class on (typname=relname) where
pg_class.oid in (select reltoastrelid from pg_class where
relname='toaster');
typowner
----------
3555301

The table and toast table owners are not affected:

# select relowner from pg_class where relname='toaster';
relowner
----------
16388

# select relowner from pg_class where oid in (select reltoastrelid from
pg_class where relname='toaster');
relowner
----------
16388

Hope this helps.

Cott

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message decibel 2009-02-21 03:57:32 Re: NOVALIDATE in postgresql?
Previous Message Rodrigo E. De León Plicet 2009-02-21 00:00:46 Re: Compatibilidad RH enterprise 5.3 !!!