pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Boulat Khakimov <boulat@inet-interactif.com>
To: pgsql-sql@postgresql.org
Subject: Writing SQL functions in Postgres
Date: Thu, 08 Mar 2001 11:44:04 -0500
Message-ID: <3AA7B6D4.C8BD7DB@inet-interactif.com> (raw)

Hi,

I want to write an SQL function in postgres that returns 
row as a result.

The problem is the select statement inside the funtion has
a two table join. So I dont know what to put after SETOF

CREATE FUNCTION dummy()
RETURNS SETOF ?????
AS 'select a.name,b.cc  
    from tblusers   a,
         tbldocs   b 
    where a.name=b.name'
LANGUAGE 'SQL';     


SETOF tblusers  -- doesnt work
ERROR:  function declared to return type tblusers does not retrieve
(tblusers.*)

neither does SETOF tbldocs

SETOF tblusers,tbldocs wont work either.

Anyone was able to returns a row that is a result of few table joins
inside the
function???

Regards,
Boulat Khakimov

 
-- 
Nothing Like the Sun



view thread (2+ messages)  latest in thread

Message-ID: <3AA7B6D4.C8BD7DB@inet-interactif.com>
Permalink:  ../3AA7B6D4.C8BD7DB@inet-interactif.com/
Also on:    postgresql.org/message-id/3AA7B6D4.C8BD7DB@inet-interactif.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: boulat@inet-interactif.com
  Subject: Re: Writing SQL functions in Postgres
  In-Reply-To: <3AA7B6D4.C8BD7DB@inet-interactif.com>
  References: <3AA7B6D4.C8BD7DB@inet-interactif.com>

* 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