Re: returning result set

From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: "Gohil, Hemant" <HGohil(at)dylt(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: returning result set
Date: 2008-09-22 22:12:54
Message-ID: 396486430809221512m2e8d521cpa4c855693be4a9be@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Mon, Sep 22, 2008 at 2:40 PM, Gohil, Hemant <HGohil(at)dylt(dot)com> wrote:

> For some reason I am not getting following error.
> ERROR: a column definition list is required for functions returning "record"

> CREATE FUNCTION function1(integer) RETURNS SETOF record AS $$

When you select from this function don't you have to also alias the
name of the SQL result and its columns?

SELECT * from function1( 2 ) AS myresult( colA, colB, colC, colD, colE );

Also, If I am not mistake, Functional alias also allow you to specify
datatypes correct?
http://www.postgresql.org/docs/8.3/interactive/sql-select.html

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message burferd 2008-09-22 22:51:42 Problems connecting to database
Previous Message Gohil, Hemant 2008-09-22 21:40:09 returning result set