pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Pailloncy Jean-Gérard <pailloncy@gdr-isis.enst.fr>
Cc: pgsql-performance@postgresql.org
Subject: Re: INSERT RULE
Date: Thu, 06 May 2004 19:10:40 +0100
Message-ID: <409A7FA0.50704@archonet.com> (raw)
In-Reply-To: <AEF2EF5C-9DB3-11D8-95E2-000A95DE2550@gdr-isis.enst.fr>
References: <A0654D6A-9D44-11D8-971A-000A95DE2550@gdr-isis.enst.fr>
	<AEF2EF5C-9DB3-11D8-95E2-000A95DE2550@gdr-isis.enst.fr>

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



view thread (3+ messages)

Message-ID: <409A7FA0.50704@archonet.com>
Permalink:  ../409A7FA0.50704@archonet.com/
Also on:    postgresql.org/message-id/409A7FA0.50704@archonet.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: dev@archonet.com, pailloncy@gdr-isis.enst.fr
  Subject: Re: INSERT RULE
  In-Reply-To: <409A7FA0.50704@archonet.com>

* 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