Bug #734: Rename column make views go bad

Поиск
Список
Период
Сортировка
От pgsql-bugs@postgresql.org
Тема Bug #734: Rename column make views go bad
Дата
Msg-id 20020808112124.6AB96475498@postgresql.org
обсуждение исходный текст
Ответы Re: Bug #734: Rename column make views go bad  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Dennis Björklund (db@zigo.dhs.org) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
Rename column make views go bad

Long Description
When I rename a column postgres seems to update the views. Or at least the views works after the update. But if I dump
thedatabase (with pg_dump) then I can not restore it since the dumped views still refer to the old column name. 

I use postgresql 7.2.1.

If the view had not worked directly after the rename I would not have been surprised (there are other changes that have
thateffect). But that everything works until you try to restore was a bit surprising. 

Sample Code
CREATE TABLE foo (
  a   integer
);

INSERT INTO foo VALUES (1);
INSERT INTO foo VALUES (2);

CREATE VIEW bar AS
  SELECT a FROM foo;

-- See, it works
SELECT * FROM bar;

ALTER TABLE bar RENAME a TO b;

-- See, it still works
SELECT * FROM bar;

-- But the definition we see here is the old one
-- and this is the one that is going to be dumped.
-- Of course it can not be restored later when it
-- refers to the wrong column name
\d bar


No file was uploaded with this report

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: "IDENT authentication failed for user" on 7.2.1 but not on 7.1.3
Следующее
От: Adam Walczykiewicz
Дата:
Сообщение: can't create plpgsql language on SCO 5