Re: insert values from a ROW object

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: insert values from a ROW object
Date: 2016-09-22 22:20:22
Message-ID: ns1lg6$hir$1@blaine.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Michael Moore schrieb am 22.09.2016 um 23:42:
> for a in select * from temp_rslt
> loop
> insert into final_rslt select row(a.*);
> end loop;
>
> I want to do something like the above. I don't want to have to name each 'a.' variable.
> Is it possible?
>

No need for a loop:

insert into final_rsl
select *
from tmp_rslt;

This assumes that both table define the columns in the exact same order

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Moore 2016-09-22 22:38:09 Re: insert values from a ROW object
Previous Message David G. Johnston 2016-09-22 21:55:55 Re: insert values from a ROW object