RULE ON INSERT and INSERT INTO ... SELECT

From: falcon <falcon(at)intercable(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: RULE ON INSERT and INSERT INTO ... SELECT
Date: 2005-04-05 18:34:40
Message-ID: 8110271129.20050405223440@intercable.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello pgsql-bugs,

I'm here again. I'm using PostgreSQL 8.0.1 on Windows and Linux Slackware 10.0

--Start test--
create sequence try3_seq;
create table try3
(
id int PRIMARY KEY,
info varchar(30)
)
without oids;
create table try4
(
id int,
info varchar(30)
)
without oids;

create table handle_try3
(
id serial PRIMARY KEY,
info varchar(30) NOT NULL DEFAULT 0
)
without oids;

-- /*
create rule try4_insert as
on insert to try4 do instead
(
insert into try3(id,info) values (nextval('try3_seq'),new.info);
insert into handle_try3(info) vales (new.info);
);
-- */
/* -- same result with
create rule try4_insert as
on insert to try4 do instead
insert into try3(id,info) values (nextval('try3_seq'),new.info);
create rule try4_insert_also
on insert to try4 do
insert into handle_try3(info) values (new.info);
*/
insert into try4(info) values ('hello'); -- simple inserts works well
insert into try4(info) values ('hell');

insert into try4(info) select info from try3;

select * from handle_try3;
/*
returns
id|info
---+---
1 |hello
2 |hell
3 |hello
4 |hell
5 |hello
6 |hell

but it seems to me, there must be only 4 rows.
*/
-- Finish Test

mailto:falcon(at)intercable(dot)ru

Browse pgsql-bugs by date

  From Date Subject
Next Message falcon 2005-04-05 18:38:37 Repeat RULE ON INSERT and DEFAULT nextval('...')
Previous Message Marcus v. Scotti 2005-04-05 17:09:25 BUG #1581: Problem with capitalised DB names...