pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Ami Ganguli <ami.ganguli@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: using a selected row as a function parameter
Date: Fri, 3 Jun 2005 09:23:28 -0600
Message-ID: <20050603152328.GA66944@winnie.fuhr.org> (raw)
In-Reply-To: <87eeecff0506030744e04eb25@mail.gmail.com>
References: <87eeecff0506030744e04eb25@mail.gmail.com>

On Fri, Jun 03, 2005 at 05:44:59PM +0300, Ami Ganguli wrote:
>
> 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".

The error I get is "subquery must return only one column".  Queries
like the following should work in 8.0.x:

SELECT queue.apply_routing_rule(m, r)
FROM (SELECT * FROM queue.messages WHERE id = 1) AS m,
     (SELECT * FROM queue.routing_rules WHERE id = 1) AS r;

SELECT queue.apply_routing_rule(m, r)
FROM queue.messages AS m, 
     queue.routing_rules AS r
WHERE m.id = 1 
  AND r.id = 1;

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



view thread (3+ messages)

Message-ID: <20050603152328.GA66944@winnie.fuhr.org>
Permalink:  ../20050603152328.GA66944@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20050603152328.GA66944@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mike@fuhr.org, ami.ganguli@gmail.com
  Subject: Re: using a selected row as a function parameter
  In-Reply-To: <20050603152328.GA66944@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox