pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Haller <ch@rodos.fzk.de>
To: drdani@mazsola.iit.uni-miskolc.hu
Cc: pgsql-sql@postgresql.org
Subject: Re: copy rows
Date: Mon, 14 Feb 2005 15:04:31 +0100
Message-ID: <4210AFEF.412532E8@rodos.fzk.de> (raw)
References: <2989532e0502082245c7e50ea@mail.gmail.com>
	<Pine.LNX.4.61.0502090849260.16831@mazsola.iit.uni-miskolc.hu>

I have not been too deep into 8.0, but AFAIK from 
the 7.x releases, the only way to do things like 
you describe, is do it the hard way: 

use SELECT INTO to get the field values you want
into variables
modify the necessary field values
do the INSERT via Executing A Dynamic Command

Inserting a record type variable has been brought up 
before, but IIRC this is not possible. 
You may like to search the archives. 

HTH
Regards, Christoph 


drdani@mazsola.iit.uni-miskolc.hu wrote:
> 
> Hi,
> 
> What is the simplest solution in plpgsql to copy some rows in a table?
> 
> I would like to do something like:
> 
> select some rows
>     do for each row
>        skip serial field  \
>        modify one field   |-- what is the simplest way for this?
>        insert as new row  /
> 
> Is it possible to insert a record type variable? If yes, how to skip a
> field?
> 
> Daniel
>



view thread (2+ messages)

Message-ID: <4210AFEF.412532E8@rodos.fzk.de>
Permalink:  ../4210AFEF.412532E8@rodos.fzk.de/
Also on:    postgresql.org/message-id/4210AFEF.412532E8@rodos.fzk.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ch@rodos.fzk.de, drdani@mazsola.iit.uni-miskolc.hu
  Subject: Re: copy rows
  In-Reply-To: <4210AFEF.412532E8@rodos.fzk.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox