Alternative to temp tables? - Mailing list pgsql-general

From Postgres User
Subject Alternative to temp tables?
Date
Msg-id b88c3460909112351m60b7782bod7fdd5d00e79505@mail.gmail.com
Whole thread Raw
Responses Re: Alternative to temp tables?  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
Hi,

I have a simple function that returns a set of rows:

CREATE OR REPLACE FUNCTION foo()
  RETURNS SETOF record AS
$$
BEGIN
    RETURN QUERY SELECT * FROM people WHERE last_name = 'jones';
END
$$
LANGUAGE 'plpgsql'

In a separate function, I call the function and store the results in a
temp table using this syntax:

INSERT INTO tmp_tbl SELECT * FROM foo()


This works, but I'd like to know if there's another way to hold the
results.  Can I get the results from foo() and store those in a local
var such as

recs record[]   OR
recs people[]

Or are temp tables the only way to hold table-based results?

pgsql-general by date:

Previous
From: "Vikram Patil"
Date:
Subject: Regarding initdb & pg_ctl
Next
From: Scott Marlowe
Date:
Subject: Re: Alternative to temp tables?