when does a function name get mapped to an OID?

From: Fran Fabrizio <ffabrizio(at)mmrd(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: when does a function name get mapped to an OID?
Date: 2002-04-23 18:06:14
Message-ID: 3CC5A296.4000306@mmrd.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


If this is answered in the docs I apologize, I've been looking around
without much success.

I am trying to bring order to our schema loading process. We have about
a dozen files with functions, triggers and views defined in them and
some of them depend on functions declared on other files, etc...so in
the past we've had situations where we unload and reload one of the
files and that breaks something that was depending on the contents of
the reloaded file (i.e. fmgr_info: 12343567 cache lookup failed
messages). So, I'm making a bit more of a sane system to make sure
things get loaded and reloaded in the right order.

I was noticing that within one of the files, something like this is
declared:

drop function bar();
drop function foo();
create function foo() returns int4 as '
select bar();
' language 'sql';
create function bar() returns int4 as '
select 1234;
' language 'sql';

This loads into the db just fine. Which got me to thinking, shouldn't
the loading of foo() throw an error since at that time bar() does not
exist? So my best guess is that function names don't get mapped to OIDs
until first actual use. Is this correct? It would save me trouble if
so since I wouldn't have to worry about the order in which they are
loaded so much as to ensure that if anything is REloaded, that any
dependencies are also reloaded.

Thanks,
Fran

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darren Ferguson 2002-04-23 18:24:17 Re: when does a function name get mapped to an OID?
Previous Message Neil Conway 2002-04-23 17:05:33 Re: Suggestions for Large DB Dump/Reload