I'm trying to implement some code to recreate tables as we discussed
formerly. But it's not so easy... :-) My first blind alley is that
dropping a function which is occured in a CHECK constraint or
a DEFAULT constraint, I get "fmgr_info: function 12345678: cache
lookup failed" or "Function OID 12345678 does not exist" (this one
only in 7.1.3; I tested this also in 7.2.1).

For me the appropriate hack seems to update some table about pg_*,
is this the proper way? Or shall I forget to hack the pg_* tables,
just drop the table and recreate it...?

Here comes my test:

create function tmp_f (integer) returns bool as
'select $1 > 0;' language 'sql';
create table tmp_t (x integer check (tmp_f(x)));
insert into tmp_t values (5);
drop function tmp_f(integer);
create function tmp_f (integer) returns bool as
'select $1 > 0;' language 'sql';
insert into tmp_t values (5);
drop function tmp_f(integer);
drop table tmp_t;

create function tmp_f (integer) returns bool as
'select $1 > 0;' language 'sql';
create table tmp_t (x integer, y bool default tmp_f(5));
insert into tmp_t values (5);
drop function tmp_f(integer);
create function tmp_f (integer) returns bool as
'select $1 > 0;' language 'sql';
insert into tmp_t values (5);
drop function tmp_f(integer);
drop table tmp_t;


TIA, Zoltan

-- 
                         Kov\'acs, Zolt\'an
                         kovacsz@pc10.radnoti-szeged.sulinet.hu
                         http://www.math.u-szeged.hu/~kovzol
                         ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz


Tue, 28 May 2002 15:53:34 +0200 (CEST)
Kovacs Zoltan <kovacsz@pc10.radnoti-szeged.sulinet.hu>
cache lookup failed: hack pg_* tables?
On Tue, 28 May 2002, Tom Lane wrote:

> Kovacs Zoltan <kovacsz@pc10.radnoti-szeged.sulinet.hu> writes:
> > I'm trying to implement some code to recreate tables as we discussed
> > formerly. But it's not so easy... :-) My first blind alley is that
> > dropping a function which is occured in a CHECK constraint or
> > a DEFAULT constraint, I get "fmgr_info: function 12345678: cache
> > lookup failed" or "Function OID 12345678 does not exist" (this one
> > only in 7.1.3; I tested this also in 7.2.1).
> 
> Use CREATE OR REPLACE FUNCTION to modify an existing function ...

Well... it works... :-) Thanks and sorry for this silly question... :-)

Zoltan


Tue, 28 May 2002 16:26:09 +0200 (CEST)
Kovacs Zoltan <kovacsz@pc10.radnoti-szeged.sulinet.hu>
Re: cache lookup failed: hack pg_* tables? 
Kovacs Zoltan <kovacsz@pc10.radnoti-szeged.sulinet.hu> writes:
> I'm trying to implement some code to recreate tables as we discussed
> formerly. But it's not so easy... :-) My first blind alley is that
> dropping a function which is occured in a CHECK constraint or
> a DEFAULT constraint, I get "fmgr_info: function 12345678: cache
> lookup failed" or "Function OID 12345678 does not exist" (this one
> only in 7.1.3; I tested this also in 7.2.1).

Use CREATE OR REPLACE FUNCTION to modify an existing function ...

			regards, tom lane

Tue, 28 May 2002 11:01:22 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: cache lookup failed: hack pg_* tables? 