Re: namespaces

Поиск
Список
Период
Сортировка
От Bill Studenmund
Тема Re: namespaces
Дата
Msg-id Pine.NEB.4.33.0110201037580.3729-100000@vespasia.home-net.internetconnect.net
обсуждение исходный текст
Ответ на Re: namespaces  ("Serguei Mokhov" <sa_mokho@alcor.concordia.ca>)
Список pgsql-hackers
On Sun, 21 Oct 2001, Serguei Mokhov wrote:

> ----- Original Message -----
> From: Bill Studenmund <wrstuden@netbsd.org>
> Sent: Friday, October 19, 2001 2:04 PM
>
> > > Quick question: would it be possible then create a 'system' package
> > > and 'system' (or 'master' if you will) schema (when it's implemented),
> > > move over all the system tables (pg_*) into the master schema
> > > and functions into the 'system' package, so that no name conflicts will arise
> > > when creating types, functions, tables, etc with the same names as system ones?
> >
> > Yes. That is part of my plan actually. :-)

Oh, one reason that needs to happen is that everything needs to be in a
package or a schema; for the tables where they do namespacing the schema
or package is part of the primary key.

> Hmm. I see. Then there won't be a problem of creating any DB object
> with the system name.

It will work, though if you start creating tables named "pg_class", I
think you might make your head hurt. Also, your own int4 type might not be
such a good idea...

> > In the patch I sent in last week,
>
> Yeah, I remember that one. Took me a couple of minutes
> to download. You know, it never hurts to compress things:
> then the patch would be ~10 times less in size, and you wouldn't
> have to worry about PINE messing up with your code in the message body... :)
> And that would reduce the bounce rate too.
>
> Just a kind and gentle cry to reduce the size of patches sent to
> my mailbox and save some bandwidth on the way :)

Ok. :-) Next time I will either compress it or I'll mail in a URL.

> > all of the built-in functions and
> > aggregates are in the "standard" package, and you can infact reference
> > them as standard.foo.
>
> When you refer to it just foo(), and you have foo() defined
> in more than one package, how do you resolve this? Do you also have
> a notion of a global package and sub-packages?

There is a very simple search path system. If you are in a package (in a
function that is part of a package), you look for foo in that package. If
you don't find it there, you look in stadard. If it's not there, you don't
find it. To look in other packages than the one you're in, you have to say
which one it is. With schemas, if your package is not in "master" or
whatever it is called, you look first in your package, then in
your_schema.standard, then in master.standard.

Take care,

Bill



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: schema support, was Package support for Postgres
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] CREATE RULE ON UPDATE/DELETE