From: | Ami Ganguli <ami(dot)ganguli(at)gmail(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | using a selected row as a function parameter |
Date: | 2005-06-03 14:44:59 |
Message-ID: | 87eeecff0506030744e04eb25@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi all,
I've been struggling with this for a while and haven't found anything
on the 'Net about it. I've created a function that takes two table
rows as a parameters. I'd like to use the output of a select (two
single rows) as the parameters, but I can't get it to work. What am I
missing?
The function prototype looks like this:
CREATE OR REPLACE FUNCTION queue.apply_routing_rule(
queue.messages,
queue.routing_rules
) RETURNS int2
and I would like to call it like this:
SELECT queue.apply_routing_rule(
(SELECT * from queue.messages WHERE id = 1),
(SELECT * from queue.routing_rules WHERE id = 1)
);
I get an error message along the lines of "sub-query must return a
single value". I've tried different combinations of "CAST" and "ROW"
functions, but they give syntax errors.
Any suggestions?
Regards,
Ami.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2005-06-03 15:11:25 | Re: 'true'::TEXT::BOOLEAN |
Previous Message | Tom Lane | 2005-06-03 14:16:34 | Re: CASE WHEN foo IS NULL THEN DEFAULT ELSE foo END |