pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ami Ganguli <ami.ganguli@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: using a selected row as a function parameter
Date: Fri, 03 Jun 2005 11:15:48 -0400
Message-ID: <5175.1117811748@sss.pgh.pa.us> (raw)
In-Reply-To: <87eeecff0506030744e04eb25@mail.gmail.com>
References: <87eeecff0506030744e04eb25@mail.gmail.com>

Ami Ganguli <ami.ganguli@gmail.com> writes:
> SELECT queue.apply_routing_rule( 
>                       (SELECT * from queue.messages WHERE id = 1),
>                       (SELECT * from queue.routing_rules WHERE id = 1)
>                       );

Not sure if that particular syntax should be expected to work,
but why not

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

The query as you want to write it will certainly fail anyway if there's
more than one row with id = 1 in either table, so it's not like there's
some huge inefficiency in doing it as a join.

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <5175.1117811748@sss.pgh.pa.us>
Permalink:  ../5175.1117811748@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5175.1117811748@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, ami.ganguli@gmail.com
  Subject: Re: using a selected row as a function parameter
  In-Reply-To: <5175.1117811748@sss.pgh.pa.us>

* 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