Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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.
Power Tools for PostgreSQL

In response to

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group