Re: INSERT RULE

From: Richard Huxton <dev(at)archonet(dot)com>
To: Pailloncy Jean-Gérard <pailloncy(at)gdr-isis(dot)enst(dot)fr>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: INSERT RULE
Date: 2004-05-06 18:10:40
Message-ID: 409A7FA0.50704@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Pailloncy Jean-Gérard wrote:
>> I try to do:
>> CREATE RULE ndicti AS ON INSERT TO ndict
>> DO INSTEAD INSERT INTO 'ndict_' || (NEW.word_id & 255)
>> VALUES( NEW.url_id, NEW.word_id, NEW.intag);
>> I got an error on 'ndict_' .
>> I did not found the right syntax.
>
> In fact I discover that
> SELECT * FROM / INSERT INTO table
> doesn't accept function that returns the name of the table as table, but
> only function that returns rows....
>
> I'm dead.
>
> Does this feature, is possible or plan ?
> Is there a trick to do it ?

You could call a plpgsql function and inside that use EXECUTE (or use
pltcl or some other interpreted language).

Not sure what you're doing will help you much though. Are you aware that
you can have partial indexes?

CREATE INDEX i123 ON ndict WHERE (word_id & 255)=123;

That might be what you're after, but it's difficult to be sure without
knowing what problem you're trying to solve.
--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Gavin Sherry 2004-05-06 22:29:11 Re: [PERFORM] [OFF-TOPIC] - Known maximum size of
Previous Message Litao Wu 2004-05-06 15:44:43 Re: pg_stat