when does a function name get mapped to an OID?

Поиск
Список
Период
Сортировка
От Fran Fabrizio
Тема when does a function name get mapped to an OID?
Дата
Msg-id 3CC5A296.4000306@mmrd.com
обсуждение исходный текст
Ответы Re: when does a function name get mapped to an OID?  (Darren Ferguson <darren@crystalballinc.com>)
Re: when does a function name get mapped to an OID?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: Suggestions for Large DB Dump/Reload
Следующее
От: Darren Ferguson
Дата:
Сообщение: Re: when does a function name get mapped to an OID?