Bug #921: Default value not available in RULE

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #921: Default value not available in RULE
Date: 2003-03-27 04:53:35
Message-ID: 20030327045335.53941475F34@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

A.Bhuvaneswaran (bhuvansql(at)myrealbox(dot)com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
Default value not available in RULE

Long Description
I as using postgresql 7.2.3.

The default value of a column is not available in the INSERT RULE. The same value is available in the trigger which is triggered before insert. Eventhough the rule is executed before the event, the default value of a column must be available in the INSERT RULE. Isn't it?

Sample Code
test_pg=# CREATE TABLE a (id int, ctime timestamp default now());
CREATE
test_pg=# CREATE TABLE a_log (id int, ctime timestamp);
CREATE
test_pg=# CREATE RULE a_rule as on insert to a do (insert into a_log (id, ctime) values (new.id, new.ctime));
CREATE
test_pg=# INSERT INTO a VALUES (1);
INSERT 14353487 1
test_pg=# SELECT * from a;
id | ctime
----+----------------------------------
1 | 2003-03-27 10:14:51.139185+05:30
(1 row)

test_pg=# SELECT * from a_log;
id | ctime
----+-------
1 |
(1 row)

test_pg=#

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-03-27 06:34:30 Re: Bug #921: Default value not available in RULE
Previous Message Gary Hendricks 2003-03-26 22:30:07 PostgreSQL book recommendation?