Re: INSERT RULE

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: INSERT RULE
Дата
Msg-id 409A7FA0.50704@archonet.com
обсуждение исходный текст
Ответ на Re: INSERT RULE  (Pailloncy Jean-Gérard <pailloncy@gdr-isis.enst.fr>)
Список 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

В списке pgsql-performance по дате отправления:

Предыдущее
От: Litao Wu
Дата:
Сообщение: Re: pg_stat
Следующее
От: Gavin Sherry
Дата:
Сообщение: Re: [pgsql-advocacy] [OFF-TOPIC] - Known maximum size of