pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joerg Hessdoerfer <Joerg.Hessdoerfer@sea-gmbh.com>
To: pgsql-sql@postgresql.org
Subject: Re: Continuous inserts...
Date: Fri, 18 Aug 2000 13:21:21 +0200
Message-ID: <4.3.2.7.0.20000818131223.00af3890@192.168.0.1> (raw)
In-Reply-To: <399D16B3.1E74DB8B@faroenet.fo>
References: <4.3.2.7.0.20000817162006.00af3db0@192.168.0.1>
	<4.3.2.7.0.20000818095440.00af6770@192.168.0.1>

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.hessdoerfer@sea-gmbh.com |
|                                http://www.sea-gmbh.com        |
+---------------------------------------------------------------+




view thread (15+ messages)  latest in thread

Message-ID: <4.3.2.7.0.20000818131223.00af3890@192.168.0.1>
Permalink:  ../4.3.2.7.0.20000818131223.00af3890@192.168.0.1/
Also on:    postgresql.org/message-id/4.3.2.7.0.20000818131223.00af3890@192.168.0.1

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: Joerg.Hessdoerfer@sea-gmbh.com
  Subject: Re: Continuous inserts...
  In-Reply-To: <4.3.2.7.0.20000818131223.00af3890@192.168.0.1>
  References: <4.3.2.7.0.20000817162006.00af3db0@192.168.0.1> <4.3.2.7.0.20000818095440.00af6770@192.168.0.1> <4.3.2.7.0.20000818131223.00af3890@192.168.0.1>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox