From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Typed-tables patch broke pg_upgrade |
Date: | 2011-04-08 20:05:49 |
Message-ID: | BANLkTi=y8RggRLcfqOj7cGuo94O4V4ekFA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Mar 30, 2011 at 12:50 PM, Peter Eisentraut <peter_e(at)gmx(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-04-08 20:10:05 | Re: WIP: Allow SQL-language functions to reference parameters by parameter name |
Previous Message | Bruce Momjian | 2011-04-08 20:02:26 | Re: pg_upgrade bug found! |