to copy a record

Поиск
Список
Период
Сортировка
От Jay O'Connor
Тема to copy a record
Дата
Msg-id 20030604113636.G874@altaica
обсуждение исходный текст
Ответы Re: to copy a record  ("Jim C. Nasby" <jim@nasby.net>)
Список pgsql-general
All,

I want to copy a record, changing only a few fields.  I was going to do
this with a plpgsql function, just by selecting the record I want copied
into a variable, changing the field I need, and doing an INSERT


My problem is that I'd like to do it without having to explicitly name each
field in the INSERT  I'd like to do something like
    ...
    DECLARE
        copyRec RECORD;

    BEGIN
        SELECT INTO copyRec...

        copyRec.field1 = newValue;

        INSERT INTO myTable VALUES (copyRec)  <---

and nor have to list each field like:

    VALUES (copyRec.field1, copyRec.field2...)

Any way of doing that?

Thanks

Take care,
Jay

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

Предыдущее
От: Avi Schwartz
Дата:
Сообщение: Nulls get converted to 0 problem
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Nulls get converted to 0 problem