passing a temporary table with more than one column to a stored procedure

From: Viktor Rosenfeld <rosenfel(at)informatik(dot)hu-berlin(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: passing a temporary table with more than one column to a stored procedure
Date: 2008-04-28 16:12:45
Message-ID: 70549E01-98F9-4D2C-84CE-15AEF2928BE0@informatik.hu-berlin.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

is there a way to pass a temporary result table with more than column
to a stored procedure?

Specifically, I would like to run a variation of this query:

SELECT
*
FROM
graphOverTokens(
(
SELECT 1 AS min, 10 AS max, 2 AS text_ref
UNTION SELECT 20 AS min, 30 AS max, 3 AS text_ref
) AS boundaries
JOIN struct ON (struct.text_ref = boundaries.text_ref)
JOIN rank ON (rank.struct_ref = struct.id)
) AS graph

I see two problems:

a) I get an error message "subquery must return only one column" when
I pass a table with more than one column as an argument to my function

b) I would have to create a complex data type of the same schema as my
argument table (a join of boundaries, struct, graph). This is not a
problem in the example above, however I would like to use a similar
function in queries where the schema of the input relation is not fixed.

Thanks,
Viktor

Responses

Browse pgsql-general by date

  From Date Subject
Next Message seijin 2008-04-28 16:39:24 String Comparison and NULL
Previous Message Craig Ringer 2008-04-28 15:48:29 Re: How to modify ENUM datatypes?