pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sathiya moorthy <mail2sathiyamoorthy@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Doubt about User-defined function.
Date: Sat, 15 Jul 2006 16:08:14 +0530
Message-ID: <6534cdd0607150338j42f31e65vadfe975cb20cca2d@mail.gmail.com> (raw)

       I have doubt about user-defined function returns value  :

             *  why function returns( accepts  ) One attribute in the
arguments of function/table, Otherwise it returns the whole record of the
table. Function accept more than arguments .
                      *   Why it doesn`t return more than one arguments in
the function (or) Attribute of that table.

            *    Its like same as C-language function, Because in C function
returns one value (or) structure/array of characters.

            *   My question is, In psql user-defined function doesn`t
returns more than one attribute. Is it possible (or) Not.

     Some examples :
            i)      create function com2(text,integer) returns text as '
select city.city from city,weather
                    where weather.city=$1 AND city.pop>$2' language sql;

                    Res : Return type of the function is Text, As well as it
is one of the argument of function.
                              ( At the type of returning, why it doesn`t
also accepts integer ).
          ii)      create function usrs_tab(text,integer) returns city as
'select city.city,city.pop,city.state from
               city,weather  where weather.city=$1 AND city.pop>$2' language
sql;

                   Res : Return one  record from City table  ( table
contains city, pop, state only ).


                                                   Thanking you.

-- 
sathiyamoorthy

view thread (2+ messages)  latest in thread

Message-ID: <6534cdd0607150338j42f31e65vadfe975cb20cca2d@mail.gmail.com>
Permalink:  ../6534cdd0607150338j42f31e65vadfe975cb20cca2d@mail.gmail.com/
Also on:    postgresql.org/message-id/6534cdd0607150338j42f31e65vadfe975cb20cca2d@mail.gmail.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mail2sathiyamoorthy@gmail.com
  Subject: Re: Doubt about User-defined function.
  In-Reply-To: <6534cdd0607150338j42f31e65vadfe975cb20cca2d@mail.gmail.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