Re: Inserting Using RowType

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Greg Lindstrom <greg(dot)lindstrom(at)novasyshealth(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Inserting Using RowType
Date: 2005-04-27 17:19:23
Message-ID: 7FAB5452-B740-11D9-8B4D-000A95B03262@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Apr 27, 2005, at 12:19 PM, Greg Lindstrom wrote:

> What I would then like to do is:
>
> INSERT INTO my_table ib837;
>
> Where the ib837 is of type my_table%rowtype. Is this possible? Is
> there another -- easier/better -- way to load these record into the
> table? The input record is fixed-width, though it does not contain
> all of the fields in the table (I add a timestamp and an id column).
>

ib837 does have all the fields of my_table if you defined it as
my_table%rowtype (even if you did not assign them all). So you could
use this:

INSERT INTO my_table VALUES (ib837.*);

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Roland Giesler 2005-04-27 17:28:13 Createlang error installing SQL-Ledger
Previous Message Michael Fuhr 2005-04-27 16:43:40 Re: query like this???