Re: Newbie question: returning rowtypes from a plpgsql function - Mailing list pgsql-general

From Tom Lane
Subject Re: Newbie question: returning rowtypes from a plpgsql function
Date
Msg-id 7928.1101913551@sss.pgh.pa.us
Whole thread Raw
In response to Re: Newbie question: returning rowtypes from a plpgsql function  (Larry White <ljw1001@gmail.com>)
List pgsql-general
Larry White <ljw1001@gmail.com> writes:
> mysql> create table t as ( select * from table_x);

That works in Postgres too.  The SELECT INTO construct is a bit broken
since, as you discovered, it has a different meaning in plpgsql than
in the main SQL language.  So I recommend using CREATE TABLE AS when
you want to create a table this way.

> The declarations section of the pl/pgsql documentation doesn't explain
> how to declare a variable to represent a set of rows

You can't.  Possibly a cursor would help?

            regards, tom lane

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: [HACKERS] Adding Reply-To: to Lists configuration ...
Next
From: "Riccardo G. Facchini"
Date:
Subject: Re: [PERFORM] pg_restore taking 4 hours!