Re: diference between calling a function in select clause and from clause

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: siva kiran balijepalli <b(dot)sivakiran(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: diference between calling a function in select clause and from clause
Date: 2011-03-16 14:22:27
Message-ID: 12293.1300285347@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

siva kiran balijepalli <b(dot)sivakiran(at)gmail(dot)com> writes:
> What i sthe difference between these two sql statements?

> select * from function-name();
> select function-name();

> The outputs of these will be same but when should we use particular one.

If the function returns a set (multiple rows) then the first is
considered better practice. If not, take your pick.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Robert Poor 2011-03-16 14:32:13 what is the PostgreSQL idiom for "insert or update"?
Previous Message Haris 2011-03-16 14:04:56 foreign key