dbTalk Databases Forums  

[BUGS] RULE ON INSERT and INSERT INTO ... SELECT

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] RULE ON INSERT and INSERT INTO ... SELECT in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
falcon
 
Posts: n/a

Default [BUGS] RULE ON INSERT and INSERT INTO ... SELECT - 04-10-2005 , 02:24 PM






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



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.