Re: Typed-tables patch broke pg_upgrade

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Typed-tables patch broke pg_upgrade
Дата
Msg-id BANLkTi=y8RggRLcfqOj7cGuo94O4V4ekFA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Typed-tables patch broke pg_upgrade  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
On Wed, Mar 30, 2011 at 12:50 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> On tor, 2011-02-10 at 06:31 +0200, Peter Eisentraut wrote:
>> > ERROR:  cannot drop column from typed table
>> >
>> > which probably is because test_type2 has a dropped column.
>>
>> It should call
>>
>> ALTER TYPE test_type2 DROP ATTRIBUTE xyz CASCADE;
>>
>> instead.  That will propagate to the table.
>
> Here is a patch that addresses this problem.
>
> It looks like Noah Misch might have found another problem in this area.
> We'll have to investigate that.

There's something wrong with this patch - it never arranges to
actually drop the phony column.  Consider:

create type foo as (a int, b int);
alter table foo drop attribute b;
create table x (a int, b int);
alter table x drop column b;

Then pg_dump --binary-upgrade emits, in relevant part, the following for x:

CREATE TABLE x (   a integer,   "........pg.dropped.2........" INTEGER /* dummy */
);

-- For binary upgrade, recreate dropped column.
UPDATE pg_catalog.pg_attribute
SET attlen = 4, attalign = 'i', attbyval = false
WHERE attname = '........pg.dropped.2........' AND attrelid IN ('x'::pg_catalog.regclass);
ALTER TABLE ONLY x DROP COLUMN "........pg.dropped.2........";

But for t we get only:

CREATE TYPE foo AS (       a integer,       "........pg.dropped.2........" INTEGER /* dummy */
);

...which is no good.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: pg_upgrade bug found!
Следующее
От: Robert Haas
Дата:
Сообщение: Re: WIP: Allow SQL-language functions to reference parameters by parameter name