From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
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:36:03 |
Message-ID: | 24344.1114623363@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Greg Lindstrom <greg(dot)lindstrom(at)novasyshealth(dot)com> writes:
> What I would then like to do is:
> INSERT INTO my_table ib837;
The trick is to get it to "burst" the rowtype value into separate columns.
I don't think you could get it to do that before 8.0, but this works
as of 8.0:
regression=# \d int8_tbl
Table "public.int8_tbl"
Column | Type | Modifiers
--------+--------+-----------
q1 | bigint |
q2 | bigint |
regression=# create function foo(bigint,bigint) returns void as $$
regression$# declare myrow int8_tbl;
regression$# begin
regression$# myrow.q1 = $1;
regression$# myrow.q2 = $2;
regression$# insert into int8_tbl select (x).* from (select myrow as x) ss;
regression$# return;
regression$# end$$ language plpgsql;
CREATE FUNCTION
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-04-27 18:08:33 | Re: Inserting Using RowType |
Previous Message | Michael Fuhr | 2005-04-27 17:34:16 | Re: Inserting Using RowType |