Re: patch: Add columns via CREATE OR REPLACE VIEW

Поиск
Список
Период
Сортировка
От Bernd Helmle
Тема Re: patch: Add columns via CREATE OR REPLACE VIEW
Дата
Msg-id EC7E967B3307C67C3DD714D1@teje
обсуждение исходный текст
Ответ на patch: Add columns via CREATE OR REPLACE VIEW  ("Robert Haas" <robertmhaas@gmail.com>)
Ответы Re: patch: Add columns via CREATE OR REPLACE VIEW  ("Robert Haas" <robertmhaas@gmail.com>)
Re: patch: Add columns via CREATE OR REPLACE VIEW  ("Robert Haas" <robertmhaas@gmail.com>)
Список pgsql-hackers
--On Donnerstag, August 07, 2008 08:03:52 -0400 Robert Haas 
<robertmhaas@gmail.com> wrote:

> Here's a patch that allows CREATE OR REPLACE VIEW to add new columns
> to an existing view.
>
> Any feedback would be appreciated, especially if it meant that I could
> fix any problems before the next commitfest.

I had a deeper look at this now. The patch looks clean and applies without 
any problems, regression tests passes. However, ATRewriteTables() has a 
problem when adding columns with domains and constraints. Consider this 
small test case:

CREATE TABLE bar (id INTEGER);
CREATE OR REPLACE VIEW vbar AS SELECT * FROM bar;
CREATE DOMAIN person AS TEXT CHECK(value IN ('haas', 'helmle'));
ALTER TABLE bar ADD COLUMN name person;
CREATE OR REPLACE VIEW vbar AS SELECT * FROM bar;

The last command confuses ATRewriteTable(), which wants to scan the 
relation leading to this error:
ERROR:  could not open relation base/16384/16476:

I see that ATRewriteTable() errors out on heap_beginscan(), since needscan 
is set to TRUE. One solution would be to teach ATRewriteTable(s) to handle 
view alteration differently in this case.

Opinions?

--  Thanks
                   Bernd


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

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1
Следующее
От: Andrew Chernow
Дата:
Сообщение: Re: Thread safety