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

Re: Inserting Using RowType

From: Michael Fuhr <mike(at)fuhr(dot)org>
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:34:16
Message-ID: 20050427173416.GA58398@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-novice
On Wed, Apr 27, 2005 at 11:19:04AM -0500, Greg Lindstrom wrote:
>
> Is it possible to INSERT data into a table using a rowtype data type?  I 
> have a long (~5000 byte, 300 field) record *which I did not design* that 
> needs to be loaded into a table.  In my plsql function I accept a line 
> from a data file.  I have declared a ib837 variable to be of 
> my_table%rowtype and go about assigning each field to the ib837 record 
> using substr on the input field (yes, that's 329 rows, sigh).  What I 
> would then like to do is:
> 
> INSERT INTO my_table ib837;

PostgreSQL 8.0 has better support for composite types than previous
versions.  For example, the following works for me in 8.0.2:

INSERT INTO my_table VALUES (ib837.*);

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2005-04-27 17:36:03
Subject: Re: Inserting Using RowType
Previous:From: Roland GieslerDate: 2005-04-27 17:28:13
Subject: Createlang error installing SQL-Ledger

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