pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michele Petrazzo - Unipex srl <michele.petrazzo@unipex.it>
To: Pgsql-Sql <pgsql-sql@postgresql.org>
Subject: Re: functions are returns columns
Date: Sat, 10 Nov 2007 18:37:51 +0100
Message-ID: <4735EC6F.5050908@unipex.it> (raw)
In-Reply-To: <162867790711091235i7e77abcch27731d91285949b6@mail.gmail.com>
References: <4734B921.5050704@unipex.it>
	<162867790711091235i7e77abcch27731d91285949b6@mail.gmail.com>

Pavel Stehule wrote:
> 
> CREATE FUNCTION getfoo(int) RETURNS foo AS $$ SELECT fooid, foosubid
> FROM foo WHERE fooid = $1 LIMIT 1; $$ LANGUAGE SQL;
> 

this return only one value, I need all the values that return the query

> or
> 
> CREATE FUNCTION getfoo(int) RETURNS SETOF foo AS $$ SELECT fooid,
> foosubid FROM foo WHERE fooid = $1; $$ LANGUAGE SQL;
> 

this create the same error:
ERROR:  return type mismatch in function declared to return foo
DETAIL:  Final SELECT returns too few columns.
CONTEXT:  SQL function "getfoo

I try with:
CREATE FUNCTION getfoo (IN int, OUT int, OUT int) AS $$
    SELECT fooid, foosubid FROM foo WHERE fooid = $1;
$$ LANGUAGE SQL;

but only one row returned...

Looking for other tips!

Thanks,
Michele



view thread (7+ messages)  latest in thread

Message-ID: <4735EC6F.5050908@unipex.it>
Permalink:  ../4735EC6F.5050908@unipex.it/
Also on:    postgresql.org/message-id/4735EC6F.5050908@unipex.it

 · 

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: michele.petrazzo@unipex.it
  Subject: Re: functions are returns columns
  In-Reply-To: <4735EC6F.5050908@unipex.it>

* 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