Обсуждение: PL/PGSQL and drop/create table

Поиск
Список
Период
Сортировка

PL/PGSQL and drop/create table

От
Teodor Sigaev
Дата:
# create table foo ( bar int );
CREATE TABLE
# create or replace function func (int) returns int as $$ DECLARE         IID alias for $1;         CNT int; BEGIN
  select into CNT count(*) from foo where bar = IID;         RETURN CNT; END; $$ language plpgsql;
 
CREATE FUNCTION
# select func(1); func
------    0
(1 row)

# drop table foo;
DROP TABLE
# create table foo ( bar int );
CREATE TABLE
# select func(1);
ERROR:  relation with OID 16628 does not exist
CONTEXT:  SQL statement "SELECT  count(*) from foo where bar =  $1 "
PL/pgSQL function "func" line 5 at select into variables


After reconnecting to database all is ok. Is it supposed behaviour?

-- 
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
  WWW: http://www.sigaev.ru/
 


Re: PL/PGSQL and drop/create table

От
Michael Fuhr
Дата:
On Wed, Sep 07, 2005 at 03:51:05PM +0400, Teodor Sigaev wrote:
> ERROR:  relation with OID 16628 does not exist
> CONTEXT:  SQL statement "SELECT  count(*) from foo where bar =  $1 "

http://www.postgresql.org/docs/faqs.FAQ.html#4.19

-- 
Michael Fuhr