pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
copy rows
2+ messages / 2 participants
[nested] [flat]

* copy rows
@ 2005-02-09 07:53 drdani@mazsola.iit.uni-miskolc.hu
  2005-02-14 14:04 ` Re: copy rows Christoph Haller <ch@rodos.fzk.de>
  0 siblings, 1 reply; 2+ messages in thread

From: drdani@mazsola.iit.uni-miskolc.hu @ 2005-02-09 07:53 UTC (permalink / raw)
  To: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: copy rows
  2005-02-09 07:53 copy rows drdani@mazsola.iit.uni-miskolc.hu
@ 2005-02-14 14:04 ` Christoph Haller <ch@rodos.fzk.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Christoph Haller @ 2005-02-14 14:04 UTC (permalink / raw)
  To: drdani@mazsola.iit.uni-miskolc.hu; +Cc: pgsql-sql

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
>



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-02-14 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-09 07:53 copy rows drdani@mazsola.iit.uni-miskolc.hu
2005-02-14 14:04 ` Christoph Haller <ch@rodos.fzk.de>

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