Re: plpgsql: inserting a record into a (matching) table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: plpgsql: inserting a record into a (matching) table
Дата
Msg-id 10280.1173823310@sss.pgh.pa.us
обсуждение исходный текст
Ответ на plpgsql: inserting a record into a (matching) table  (Brian Hurt <bhurt@janestcapital.com>)
Список pgsql-novice
Brian Hurt <bhurt@janestcapital.com> writes:
> I'd like to do is something like (note that this does not work):

>     FOR t_rec IN
>         SELECT * from foo_table WHERE primary_key = old_key
>         t_rec.primary_key := new_key;
>         t_rec.other_column := new_value;
>         INSERT INTO foo_table VALUES ( t_rec ); -- Wrong- does not work

As of PG 8.2 I think that that will work if you say "t_rec.*" in the
VALUES.  As-is, it's asking the system to insert a composite datum into
the first column of the table.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Error 25P02 - transaction aborted - Potential causes?
Следующее
От: Aly Dharshi
Дата:
Сообщение: Re: [HACKERS] initdb fails - postgresql does not support leap seconds