pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedCalling functions from within pl/pgsql
4+ messages / 2 participants
[nested] [flat]
* Calling functions from within pl/pgsql
@ 2007-12-04 12:16 Achilleas Mantzios <achill@matrix.gatewaynet.com>
2007-12-04 12:59 ` Re: Calling functions from within pl/pgsql Pavel Stehule <pavel.stehule@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Achilleas Mantzios @ 2007-12-04 12:16 UTC (permalink / raw)
To: pgsql-sql
I noticed that in pl/pgsql simply
result := funcname(func,args,...);
just works.
Should i rely on it or take it as a coincidence? :)
--
Achilleas Mantzios
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Calling functions from within pl/pgsql
2007-12-04 12:16 Calling functions from within pl/pgsql Achilleas Mantzios <achill@matrix.gatewaynet.com>
@ 2007-12-04 12:59 ` Pavel Stehule <pavel.stehule@gmail.com>
2007-12-04 13:23 ` Re: Calling functions from within pl/pgsql Achilleas Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 1 reply; 4+ messages in thread
From: Pavel Stehule @ 2007-12-04 12:59 UTC (permalink / raw)
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>; +Cc: pgsql-sql
On 04/12/2007, Achilleas Mantzios <achill@matrix.gatewaynet.com> wrote:
> I noticed that in pl/pgsql simply
> result := funcname(func,args,...);
> just works.
> Should i rely on it or take it as a coincidence? :)
You found assignment :). Sure, you can use it.
http://www.postgresql.org/docs/8.2/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT
Regards
Pavel Stehule
> --
> Achilleas Mantzios
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Calling functions from within pl/pgsql
2007-12-04 12:16 Calling functions from within pl/pgsql Achilleas Mantzios <achill@matrix.gatewaynet.com>
2007-12-04 12:59 ` Re: Calling functions from within pl/pgsql Pavel Stehule <pavel.stehule@gmail.com>
@ 2007-12-04 13:23 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2007-12-04 13:41 ` Re: Calling functions from within pl/pgsql Pavel Stehule <pavel.stehule@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Achilleas Mantzios @ 2007-12-04 13:23 UTC (permalink / raw)
To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: pgsql-sql
Στις Tuesday 04 December 2007 14:59:43 ο/η Pavel Stehule έγραψε:
> On 04/12/2007, Achilleas Mantzios <achill@matrix.gatewaynet.com> wrote:
> > I noticed that in pl/pgsql simply
> > result := funcname(func,args,...);
> > just works.
> > Should i rely on it or take it as a coincidence? :)
>
> You found assignment :). Sure, you can use it.
> http://www.postgresql.org/docs/8.2/interactive/plpgsql-statements.html#PLPG
>SQL-STATEMENTS-ASSIGNMENT
Sure, i missed the
"As explained above, the expression in such a statement is evaluated by means
of an SQL SELECT command sent to the main database engine. The expression
must yield a single value."
part.
Thanx.
>
> Regards
> Pavel Stehule
>
> > --
> > Achilleas Mantzios
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: explain analyze is your friend
--
Achilleas Mantzios
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Calling functions from within pl/pgsql
2007-12-04 12:16 Calling functions from within pl/pgsql Achilleas Mantzios <achill@matrix.gatewaynet.com>
2007-12-04 12:59 ` Re: Calling functions from within pl/pgsql Pavel Stehule <pavel.stehule@gmail.com>
2007-12-04 13:23 ` Re: Calling functions from within pl/pgsql Achilleas Mantzios <achill@matrix.gatewaynet.com>
@ 2007-12-04 13:41 ` Pavel Stehule <pavel.stehule@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Stehule @ 2007-12-04 13:41 UTC (permalink / raw)
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>; +Cc: pgsql-sql
Hello
a := exprx
is internally translated :
get result of SELECT exprx
and store it to a
so you can write select sin(10); then you can a := sin(10)
but you can too use subselect like:
SELECT (SELECT v FROM foo LIMIT 1) ~ you can write
a := (SELECT v FROM foo LIMIT 1);
that is equal to SELECT INTO a v FROM foo
Pavel
> > http://www.postgresql.org/docs/8.2/interactive/plpgsql-statements.html#PLPG
> >SQL-STATEMENTS-ASSIGNMENT
>
> Sure, i missed the
> "As explained above, the expression in such a statement is evaluated by means
> of an SQL SELECT command sent to the main database engine. The expression
> must yield a single value."
> part.
> Thanx.
>
> >
> > Regards
> > Pavel Stehule
> >
> > > --
> > > Achilleas Mantzios
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 6: explain analyze is your friend
>
>
>
> --
> Achilleas Mantzios
>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2007-12-04 13:41 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-12-04 12:16 Calling functions from within pl/pgsql Achilleas Mantzios <achill@matrix.gatewaynet.com>
2007-12-04 12:59 ` Pavel Stehule <pavel.stehule@gmail.com>
2007-12-04 13:23 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2007-12-04 13:41 ` Pavel Stehule <pavel.stehule@gmail.com>
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