agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: insert values from a ROW object
Date: Fri, 23 Sep 2016 00:20:22 +0200
Message-ID: <ns1lg6$hir$1@blaine.gmane.org> (raw)
In-Reply-To: <CACpWLjMR2-1XOMd7y6WbHribWUvNrxq42jxeDbv7CVsve1H9CQ@mail.gmail.com>
References: <CACpWLjMR2-1XOMd7y6WbHribWUvNrxq42jxeDbv7CVsve1H9CQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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







-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (5+ messages)  latest in thread

Message-ID: <ns1lg6$hir$1@blaine.gmane.org>
Permalink:  ../ns1lg6$hir$1@blaine.gmane.org/
Also on:    postgresql.org/message-id/ns1lg6$hir$1@blaine.gmane.org

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: spam_eater@gmx.net
  Subject: Re: insert values from a ROW object
  In-Reply-To: <ns1lg6$hir$1@blaine.gmane.org>

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

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