pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adam Witney <awitney@sghms.ac.uk>
To: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Subqueries returning more than one value?
Date: Tue, 11 May 2004 01:09:34 +0100
Message-ID: <BCC5D84E.32817%awitney@sghms.ac.uk> (raw)


Hi,

I am using a function in a subquery, this works ok:

SELECT name, (SELECT p_my_func(1)) AS id
  FROM test;

However I would like to have the function return 2 values into the main
query... Something like this:

SELECT name, (SELECT p_my_func(1)) AS (id, type)
  FROM test;

Of course this gives the error:

ERROR:  subquery must return only one column

Is there any way around this?

Thanks for any help

adam


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




view thread (2+ messages)  latest in thread

Message-ID: <BCC5D84E.32817%awitney@sghms.ac.uk>
Permalink:  ../BCC5D84E.32817%25awitney@sghms.ac.uk/
Also on:    postgresql.org/message-id/BCC5D84E.32817%awitney@sghms.ac.uk

 · 

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: awitney@sghms.ac.uk
  Subject: Re: Subqueries returning more than one value?
  In-Reply-To: <BCC5D84E.32817%awitney@sghms.ac.uk>

* 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