Re: PL/pgSQL examples NOT involving functions

From: "Aasmund Midttun Godal" <postgresql(at)envisity(dot)com>
To: josh(at)agliodbs(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: PL/pgSQL examples NOT involving functions
Date: 2001-11-27 19:53:51
Message-ID: 20011127195351.12651.qmail@213-145-170-138.dd.nextgentel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-sql

envisity=# create table temp (tempid integer);
CREATE
envisity=# INSERT INTO temp VALUES(1);

CREATE FUNCTION test3() RETURNS INTEGER AS 'DECLARE id INTEGER; BEGIN SELECT INTO id tempid FROM temp LIMIT 1; RETURN id; END;' LANGUAGE 'plpgsql';
DROP
CREATE
envisity=# select test3();
test3
-------
1
(1 row)

envisity=# DROP TABLE temp ;
DROP
envisity=# create table temp (tempid integer);
CREATE
envisity=# INSERT INTO temp VALUES(3);
INSERT 150371 1
envisity=# select test3();
ERROR: Relation 150348 does not exist
envisity=#

Regards,

Aasmund.

On Mon, 26 Nov 2001 17:23:13 -0800, "Josh Berkus" <josh(at)agliodbs(dot)com> wrote:
> Aasmund,
>
>
> This is incorrect. This happens with views, but not with functions.
>
> -Josh
>
>
> ______AGLIO DATABASE SOLUTIONS___________________________
> Josh Berkus
> Complete information technology josh(at)agliodbs(dot)com
> and data management solutions (415) 565-7293
> for law firms, small businesses fax 621-2533
> and non-profit organizations. San Francisco
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

Aasmund Midttun Godal

aasmund(at)godal(dot)com - http://www.godal.com/
+47 40 45 20 46

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Aasmund Midttun Godal 2001-11-27 19:55:17 Re: PL/pgSQL examples NOT involving functions
Previous Message Bruno Wolff III 2001-11-27 17:17:09 database permissions (7.3) comment

Browse pgsql-sql by date

  From Date Subject
Next Message Aasmund Midttun Godal 2001-11-27 19:55:17 Re: PL/pgSQL examples NOT involving functions
Previous Message Richard Poole 2001-11-27 14:25:30 Re: count(*) - join question