Re: triggers and execute...

Поиск
Список
Период
Сортировка
От Richard Broersma
Тема Re: triggers and execute...
Дата
Msg-id 396486430904271424u5ffce6cmc3ff389bf356ec2d@mail.gmail.com
обсуждение исходный текст
Ответ на triggers and execute...  (Scott Marlowe <scott.marlowe@gmail.com>)
Ответы Re: triggers and execute...  (Scott Marlowe <scott.marlowe@gmail.com>)
Re: triggers and execute...  (Scott Marlowe <scott.marlowe@gmail.com>)
Список pgsql-general
On Mon, Apr 27, 2009 at 1:32 PM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
> OK, I'm hitting a wall here.  I've written this trigger for partitioning:
>
> create or replace function page_access_insert_trigger ()
> returns trigger as $$
> DECLARE
>        part text;
>        q text;
> BEGIN
>        part = to_char(new."timestamp",'YYYYMMDD');
>        q = 'insert into page_access_'||part||' values (new.*)';
> ...
>
> When I create it and try to use it I get this error:
> ERROR:  NEW used in query that is not in a rule
> CONTEXT:  SQL statement "insert into page_access_20090427 values (new.*)"

At this point I don't think that there is a way for this function to
know the correct table type of new.* since page_access_... is still
only a concatenated string.  There there a way to cast new.* to the
correct table type as part of this insert statement?

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

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

Предыдущее
От: Grzegorz Jaśkiewicz
Дата:
Сообщение: Re: Query organization question
Следующее
От: "Gauthier, Dave"
Дата:
Сообщение: Re: Query organization question