Re: PL/pgSQL examples NOT involving functions
От | |
---|---|
Тема | Re: PL/pgSQL examples NOT involving functions |
Дата | |
Msg-id | 200111280034.09d3@lh00.opsion.fr обсуждение исходный текст |
Ответ на | PL/pgSQL examples NOT involving functions (Roland Roberts <roland@astrofoto.org>) |
Ответы |
Re: PL/pgSQL examples NOT involving functions
|
Список | pgsql-sql |
Hello! > 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 If I exit plpgsql and reenter, then "select test3()" works again. So I guess "the first time" in "The PL/pgSQL call handler parses the function's source text and produces an internal binary instruction tree the first time the function is called." might be referring to "for each client connection". CN -------------------------------------------------------- You too can have your own email address from Eurosport. http://www.eurosport.com
В списке pgsql-sql по дате отправления: