X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1649CD1EB31 for ; Thu, 6 May 2004 15:11:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 85942-08 for ; Thu, 6 May 2004 15:10:41 -0300 (ADT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id 7BD37D1F30E for ; Thu, 6 May 2004 15:10:40 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 3.35 #1) id 1BLnKS-000F7N-0Z; Thu, 06 May 2004 19:10:40 +0100 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 21065167FA; Thu, 6 May 2004 19:10:39 +0100 (BST) Message-ID: <409A7FA0.50704@archonet.com> Date: Thu, 06 May 2004 19:10:40 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Pailloncy_Jean-G=E9rard?= Cc: pgsql-performance@postgresql.org Subject: Re: INSERT RULE References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/51 X-Sequence-Number: 6882 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