Bug with views and defaults

Поиск
Список
Период
Сортировка
От Mark Hollomon
Тема Bug with views and defaults
Дата
Msg-id 3948E296.6CA16A0A@americasm01.nt.com
обсуждение исходный текст
Ответы Re: Bug with views and defaults  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
CREATE TABLE foo (name TEXT,type CHAR(1),when_added TIMESTAMP DEFAULT 'now'
);

CREATE VIEW mytype AS SELECT name, when_added FROM foo WHERE type = 'M';

CREATE RULE mytype_insert ASON INSERT TO mytype DO INSTEADINSERT INTO foo (name, type) VALUES (NEW.name, 'M');

db=# insert into foo (name, type) VALUES ('n1', 'M');
INSERT 414488 1
db=# insert into mytype (name) VALUES ('n2');
INSERT 414489 1
db=# select * from foo;name | type |       when_added
------+------+------------------------n1   | M    | 2000-06-15 09:53:44-04n2   | M    | 2000-06-15 09:52:27-04
(2 rows)

Inserting directly into foo sets when_added to the current time.
Inserting through the view sets it to what looks like the time of
view creation.

-- 

Mark Hollomon
mhh@nortelnetworks.com
ESN 451-9008 (302)454-9008


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Big 7.1 open items
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: Re: Big 7.1 open items