Re: BUG #5400: Columns count mismatch in RULE with subquery

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: BUG #5400: Columns count mismatch in RULE with subquery
Дата
Msg-id
20806.1270046117@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
BUG #5400: Columns count mismatch in RULE with subquery "Teodor Buchner" <t.buchner@autoguard.pl>
Re: BUG #5400: Columns count mismatch in RULE with subquery Tom Lane <tgl@sss.pgh.pa.us>
"Teodor Buchner"  writes:
> CREATE OR REPLACE RULE move_iteration_1 AS ON INSERT TO a.iteration  DO ALSO

> INSERT INTO b.iteration(id,date_period_begin)
>     SELECT (NEW.id,NEW.date_period_begin) FROM a.iteration;

Your use of parentheses in the SELECT targetlist is incorrect (and would
be with or without the RULE context).  What this is trying to do is
insert a single composite column into the target table.  You want

INSERT INTO b.iteration(id,date_period_begin)
    SELECT NEW.id,NEW.date_period_begin FROM a.iteration;

			regards, tom lane
В списке pgsql-bugs по дате отправления
От: Kevin Grittner
Дата:
Сообщение: Re: dividing money by money
От: Andy Balholm
Дата:
Сообщение: Re: dividing money by money
FAQ