Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group