rules and default values

Поиск
Список
Период
Сортировка
От nconway@klamath.dyndns.org (Neil Conway)
Тема rules and default values
Дата
Msg-id 20020330235346.GD27863@klamath.dyndns.org
обсуждение исходный текст
Ответы Re: rules and default values
Список pgsql-hackers
Hi all,

In IRC, "StuckMojo" commented that the following behavior doesn't seem
to be ideal:

nconway=> create table my_table (col1 int default 5, col2 int default
10);
CREATE
nconway=> create view my_view (col1, col2) as select * from my_table;
CREATE
nconway=> create rule insert_rule as on insert to my_view do instead
insert into my_table values (new.*);
CREATE
nconway=> insert into my_table default values;
INSERT 112714 1
nconway=> insert into my_view default values;
INSERT 0 0
nconway=> select * from my_table;col1 | col2 
------+------   5 |   10     |     
(2 rows)

In other words, when the insert statement on the view is transformed by
the rule, the "default value" columns are replaced by explicit NULL
values (which is the default value for the columns of the pseudo-table
created by CREATE VIEW). Is this the correct behavior?

Cheers,

Neil

-- 
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: How to give permission to others on data directory
Следующее
От: Tom Lane
Дата:
Сообщение: Re: rules and default values