pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedSchema and Namespace Oid confusion
4+ messages / 3 participants
[nested] [flat]
* Schema and Namespace Oid confusion
@ 2018-12-28 12:44 ZongtianHou <zongtianhou@icloud.com>
0 siblings, 2 replies; 4+ messages in thread
From: ZongtianHou @ 2018-12-28 12:44 UTC (permalink / raw)
To: pgsql-admin
Hi, everyone
I get somehow confused when I learn about namespace here, there are two questions,
First, what is the difference between namespace and schema?
Second, why the Oid of public namespace is 2200, the same between databases? Does oid is unique for every object across cluster?
Does someone know about these clearly?
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Schema and Namespace Oid confusion
@ 2018-12-28 15:36 Alvaro Herrera <alvherre@2ndquadrant.com>
parent: ZongtianHou <zongtianhou@icloud.com>
1 sibling, 1 reply; 4+ messages in thread
From: Alvaro Herrera @ 2018-12-28 15:36 UTC (permalink / raw)
To: ZongtianHou <zongtianhou@icloud.com>; +Cc: pgsql-admin
Hello
On 2018-Dec-28, ZongtianHou wrote:
> I get somehow confused when I learn about namespace here, there are two questions,
> First, what is the difference between namespace and schema?
None. Schema is the user-visible name for the feature; namespace is the
source code and system catalog level.
> Second, why the Oid of public namespace is 2200, the same between
> databases?
Not necessarily. That's the initial value, but it's possible to drop
the public schema and create it afresh.
> Does oid is unique for every object across cluster?
No, only inside each individual catalog are OIDs guaranteed unique.
> Does someone know about these clearly?
Yes.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Schema and Namespace Oid confusion
@ 2018-12-28 15:39 Tom Lane <tgl@sss.pgh.pa.us>
parent: ZongtianHou <zongtianhou@icloud.com>
1 sibling, 0 replies; 4+ messages in thread
From: Tom Lane @ 2018-12-28 15:39 UTC (permalink / raw)
To: ZongtianHou <zongtianhou@icloud.com>; +Cc: pgsql-admin
ZongtianHou <zongtianhou@icloud.com> writes:
> First, what is the difference between namespace and schema?
None.
> Second, why the Oid of public namespace is 2200, the same between databases? Does oid is unique for every object across cluster?
CREATE DATABASE physically clones the template database, so all objects
have the same OIDs they had in the template. OID uniqueness is only
expected for objects within one database (and even then, only across
objects in the same system catalog), not across the whole cluster.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Schema and Namespace Oid confusion
@ 2018-12-29 01:10 ZongtianHou <zongtianhou@icloud.com>
parent: Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 0 replies; 4+ messages in thread
From: ZongtianHou @ 2018-12-29 01:10 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: pgsql-admin
Thank you very much, got it.
> On 28 Dec 2018, at 11:36 PM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
>
> Hello
>
> On 2018-Dec-28, ZongtianHou wrote:
>
>> I get somehow confused when I learn about namespace here, there are two questions,
>> First, what is the difference between namespace and schema?
>
> None. Schema is the user-visible name for the feature; namespace is the
> source code and system catalog level.
>
>> Second, why the Oid of public namespace is 2200, the same between
>> databases?
>
> Not necessarily. That's the initial value, but it's possible to drop
> the public schema and create it afresh.
>
>> Does oid is unique for every object across cluster?
>
> No, only inside each individual catalog are OIDs guaranteed unique.
>
>> Does someone know about these clearly?
>
> Yes.
>
> --
> Álvaro Herrera https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2018-12-29 01:10 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-12-28 12:44 Schema and Namespace Oid confusion ZongtianHou <zongtianhou@icloud.com>
2018-12-28 15:36 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2018-12-29 01:10 ` ZongtianHou <zongtianhou@icloud.com>
2018-12-28 15:39 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox