Re: Elegant copy of a row using PL - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Elegant copy of a row using PL
Date
Msg-id b42b73150701160959r4ee5697bw6f69eb18d71e4460@mail.gmail.com
Whole thread Raw
In response to Elegant copy of a row using PL  ("richard lavoie" <richard_lavoie@gmx.de>)
Responses Re: Elegant copy of a row using PL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 1/16/07, richard lavoie <richard_lavoie@gmx.de> wrote:
> Hi!
>
>
> I'm not sure about the English terminology for that so I'm sorry if I made a
> mistake on the subject and on this message.
>
> I've a table with 50 colums. I want to copy a certain row using PL and change only 2 values. The way to do it with
insertis to long. Is there any other elegant way? 

the basic methodology is to:

insert select into a scratch table;
update scratch table;
insert select back into real_table;

scratch can be a persistent table (remember to truncate it) or a temp
table.  if it is a temp, remember to create it before you call your pl
for the first time in a session.

merlin

pgsql-general by date:

Previous
From: Max Ueda
Date:
Subject: Re: Coercion in PGSQL?
Next
From: "Furesz Peter"
Date:
Subject: trigger howto question