From: | "Mark Hollomon" <mhh(at)nortelnetworks(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Bug with views and defaults |
Date: | 2000-06-15 14:05:10 |
Message-ID: | 3948E296.6CA16A0A@americasm01.nt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 AS
ON INSERT TO mytype DO INSTEAD
INSERT 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-04
n2 | 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(at)nortelnetworks(dot)com
ESN 451-9008 (302)454-9008
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Lockhart | 2000-06-15 14:14:47 | Re: Re: Big 7.1 open items |
Previous Message | Bruce Momjian | 2000-06-15 13:53:14 | Re: Re: Big 7.1 open items |