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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

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