From: | Joerg Hessdoerfer <Joerg(dot)Hessdoerfer(at)sea-gmbh(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Continuous inserts... |
Date: | 2000-08-18 11:21:21 |
Message-ID: | 4.3.2.7.0.20000818131223.00af3890@192.168.0.1 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi!
At 11:57 18.08.00 +0100, you wrote:
>I'm not familiar with rules. Could you please post the SQL for creating
>the rule
>that you've created?
Here we go (if memory serves ;-)
create table a ( num int4, name text );
create table b ( num int4, name text );
rule to insert into b instead of a:
CREATE RULE redirect AS ON insert TO a DO INSTEAD insert into b values (
new.num, new.name );
... the INSTEAD is important!
BTW: is it really necessary to list all fields in the instead part? Anyone?
when finished vacuuming a, do a
DROP RULE redirect;
of course, when you have more/other fields in your table, you need to
change rule's definition.
Hope this helps,
Joerg
+------**** Science & Engineering Applications GmbH ****------+
| |
| Joerg Hessdoerfer |
| Leading SW developer Phone: +49 (0)2203-962211 |
| S.E.A GmbH Fax: -962212 |
| D-51147 Koeln Internet: joerg(dot)hessdoerfer(at)sea-gmbh(dot)com |
| http://www.sea-gmbh.com |
+---------------------------------------------------------------+
From | Date | Subject | |
---|---|---|---|
Next Message | Graham Vickrage | 2000-08-18 12:24:15 | sequences in functions |
Previous Message | Poul L. Christiansen | 2000-08-18 10:57:55 | Re: Continuous inserts... |