Re: Inserting Using RowType - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: Inserting Using RowType
Date
Msg-id 20050427173416.GA58398@winnie.fuhr.org
Whole thread Raw
In response to Inserting Using RowType  (Greg Lindstrom <greg.lindstrom@novasyshealth.com>)
Responses Re: Inserting Using RowType  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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/

pgsql-novice by date:

Previous
From: "Roland Giesler"
Date:
Subject: Createlang error installing SQL-Ledger
Next
From: Tom Lane
Date:
Subject: Re: Inserting Using RowType