pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Calling functions from within pl/pgsql
Date: Tue, 4 Dec 2007 14:41:51 +0100
Message-ID: <162867790712040541j296bbc8dt9383293690872c64@mail.gmail.com> (raw)
In-Reply-To: <200712041523.05011.achill@matrix.gatewaynet.com>
References: <200712041416.50322.achill@matrix.gatewaynet.com>
	<162867790712040459s6ee86399h5dac46cc20d95e9f@mail.gmail.com>
	<200712041523.05011.achill@matrix.gatewaynet.com>

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
>



view thread (4+ messages)

Message-ID: <162867790712040541j296bbc8dt9383293690872c64@mail.gmail.com>
Permalink:  ../162867790712040541j296bbc8dt9383293690872c64@mail.gmail.com/
Also on:    postgresql.org/message-id/162867790712040541j296bbc8dt9383293690872c64@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: pavel.stehule@gmail.com, achill@matrix.gatewaynet.com
  Subject: Re: Calling functions from within pl/pgsql
  In-Reply-To: <162867790712040541j296bbc8dt9383293690872c64@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