Re: How do I insert a record into a table? - Mailing list pgsql-novice

From Richard Broersma Jr
Subject Re: How do I insert a record into a table?
Date
Msg-id 400429.67003.qm@web31810.mail.mud.yahoo.com
Whole thread Raw
In response to How do I insert a record into a table?  (Brian Hurt <bhurt@janestcapital.com>)
Responses Re: How do I insert a record into a table?
List pgsql-novice
--- Brian Hurt <bhurt@janestcapital.com> wrote:

>
> I want to write a query like:
> INSERT INTO table SELECT func(args);
> where func is defined as:
> CREATE OR REPLACE FUNCTION func(args)
> RETURNS table
> AS $_$
>     ...
> $_$ LANGUAGE plpgsql;
> Unfortunately, when I try to do this, I get:
> ERROR: column "first_column" is of type integer but expression is of
> type record
> I get this error even if I list the columns:
> INSTER INTO table(first_column, second_column, ...) ....
> So how do I take a record returned from a function, and insert it as a
> row into a table?

What does a select * from table; look like?
What does a select * from func(args); look like?

Regards,
Richard Broersma Jr.

pgsql-novice by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: How do I insert a record into a table?
Next
From: Derrick Betts
Date:
Subject: Re: How do I insert a record into a table?