Bug #921: Default value not available in RULE

Started by PostgreSQL Bugs Listabout 23 years ago2 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

A.Bhuvaneswaran (bhuvansql@myrealbox.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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PostgreSQL Bugs List (#1)
Re: Bug #921: Default value not available in RULE

pgsql-bugs@postgresql.org writes:

Default value not available in RULE

I as using postgresql 7.2.3.

Update to 7.3.*.

regards, tom lane