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

Re: How do I insert a record into a table?

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Brian Hurt <bhurt(at)janestcapital(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: How do I insert a record into a table?
Date: 2007-06-01 19:06:38
Message-ID: 400429.67003.qm@web31810.mail.mud.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-novice
--- Brian Hurt <bhurt(at)janestcapital(dot)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.

In response to

Responses

pgsql-novice by date

Next:From: Derrick BettsDate: 2007-06-01 19:30:19
Subject: Re: How do I insert a record into a table?
Previous:From: Michael GlaesemannDate: 2007-06-01 19:03:47
Subject: Re: How do I insert a record into a table?

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