Re: when does a function name get mapped to an OID?

Поиск
Список
Период
Сортировка
От Darren Ferguson
Тема Re: when does a function name get mapped to an OID?
Дата
Msg-id Pine.LNX.4.10.10204231422210.7360-100000@thread.crystalballinc.com
обсуждение исходный текст
Ответ на when does a function name get mapped to an OID?  (Fran Fabrizio <ffabrizio@mmrd.com>)
Список pgsql-general
On Tue, 23 Apr 2002, Fran Fabrizio wrote:

>
> 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?

This will throw an error if you try and run foo() before you create bar().
But from my experience the function is compiled when it is first run a
plan created. It is not compiled at creation time.


> 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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>

HTH

Darren Ferguson


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

Предыдущее
От: Fran Fabrizio
Дата:
Сообщение: when does a function name get mapped to an OID?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: when does a function name get mapped to an OID?