X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8C5FA9FA3B4 for ; Sat, 15 Jul 2006 19:10:21 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 99221-01 for ; Sat, 15 Jul 2006 19:10:16 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by postgresql.org (Postfix) with ESMTP id 9CA079F95E3 for ; Sat, 15 Jul 2006 19:10:16 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id p77so166937nfc for ; Sat, 15 Jul 2006 15:10:15 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=MLbJrMcitZHNkjLDMG8dpGcHOCdzYcBtxlYeWGx5iJ7bqk8GwAeGFLUUuYTo+/EH/PXzUIR6FFR+Y8RSjZOmAmwZt/Caz0Hy0HoyUA1Ryq/+ZxsvT4KghdQnYalCAtOPdXsFwE3IhLhMILanL3mP7r6ZGB9jSc2xtVEnoO8RAHk= Received: by 10.78.159.7 with SMTP id h7mr276029hue; Sat, 15 Jul 2006 15:10:14 -0700 (PDT) Received: by 10.78.29.15 with HTTP; Sat, 15 Jul 2006 15:10:14 -0700 (PDT) Message-ID: Date: Sat, 15 Jul 2006 17:10:14 -0500 From: "Aaron Bono" To: "sathiya moorthy" Subject: Re: Doubt about User-defined function. Cc: pgsql-sql@postgresql.org In-Reply-To: <6534cdd0607150338j42f31e65vadfe975cb20cca2d@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_42762_15172087.1153001414837" References: <6534cdd0607150338j42f31e65vadfe975cb20cca2d@mail.gmail.com> X-Google-Sender-Auth: b8fe85b116b79676 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/217 X-Sequence-Number: 25791 ------=_Part_42762_15172087.1153001414837 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I am really confused about what your question is. Functions can take zero to many arguments and return one value. The argument types are different from (or at least are independent of) the return value. Arguments are not returned, they are passed into the function. Your use of the terminology appears to be inconsistent with the definitions of these words. -Aaron On 7/15/06, sathiya moorthy wrote: > > 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 ). > ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com ================================================================== ------=_Part_42762_15172087.1153001414837 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I am really confused about what your question is.  Functions can take zero to many arguments and return one value.  The argument types are different from (or at least are independent of) the return value.  Arguments are not returned, they are passed into the function.  Your use of the terminology appears to be inconsistent with the definitions of these words.

-Aaron

On 7/15/06, sathiya moorthy <mail2sathiyamoorthy@gmail.com> wrote:
       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 ).

==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
================================================================== ------=_Part_42762_15172087.1153001414837--