Re: uncataloged tables are a vestigial husk

Lists: pgsql-hackers
From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: uncataloged tables are a vestigial husk
Date: 2012-06-13 16:36:11
Message-ID: CA+TgmobKKc7C6zwfvEhYK5f+gWjpty7A8kLmHAe4h-9vDksB_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

While working on some code today, I noticed that RELKIND_UNCATALOGED
appears to serve no useful purpose. In the few places where we check
for it at all, we treat it in exactly the same way as
RELKIND_RELATION. It seems that it's only purpose is to serve as a
placeholder inside each newly-created relcache entry until the real
relkind is filled in. But this seems pretty silly, because
RelationBuildLocalRelation(), where the relcache entry is created, is
called in only one place, heap_create(), which already knows the
relkind. So, essentially, right now, we're relying on the callers of
heap_create() to pass in a relkind and then, after heap_create()
returns, stick that same relkind into the relcache entry before
inserting the pg_class tuple. The only place where that doesn't
happen is in the bootstrap code, which instead allows
RELKIND_UNCATALOGED to stick around in the relcache entry even though
we have RELKIND_RELATION in the pg_class tuple. But we don't actually
rely on that for anything, so it seems this is just an unnecessary
complication.

The attached patch cleans it up by removing RELKIND_UNCATALOGED and
teaching RelationBuildLocalRelation() to set the relkind itself.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
remove-relkind-uncataloged.patch application/octet-stream 5.7 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: uncataloged tables are a vestigial husk
Date: 2012-06-13 17:13:43
Message-ID: 13032.1339607623@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> While working on some code today, I noticed that RELKIND_UNCATALOGED
> appears to serve no useful purpose. In the few places where we check
> for it at all, we treat it in exactly the same way as
> RELKIND_RELATION. It seems that it's only purpose is to serve as a
> placeholder inside each newly-created relcache entry until the real
> relkind is filled in.

I suspect that it had some actual usefulness back in Berkeley days.
But now that catalogs are created with the correct relkind to start
with during initdb, I agree it's probably just inertia keeping that
around.

> The attached patch cleans it up by removing RELKIND_UNCATALOGED and
> teaching RelationBuildLocalRelation() to set the relkind itself.

I think there are probably some places to fix in the docs too.

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: uncataloged tables are a vestigial husk
Date: 2012-06-13 17:17:39
Message-ID: CA+Tgmob7QG93E1FohEFBweF-cCCRuR+JD0DyQnwj2ssrY3evzA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Jun 13, 2012 at 1:13 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> The attached patch cleans it up by removing RELKIND_UNCATALOGED and
>> teaching RelationBuildLocalRelation() to set the relkind itself.
>
> I think there are probably some places to fix in the docs too.

catalogs.sgml doesn't include it in the list of possible relkinds,
since it never hits the disk. And grep -i uncatalog doc/src/sgml
comes up empty. Where else should I be looking?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: uncataloged tables are a vestigial husk
Date: 2012-06-13 17:22:39
Message-ID: 13178.1339608159@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Jun 13, 2012 at 1:13 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> The attached patch cleans it up by removing RELKIND_UNCATALOGED and
>>> teaching RelationBuildLocalRelation() to set the relkind itself.

>> I think there are probably some places to fix in the docs too.

> catalogs.sgml doesn't include it in the list of possible relkinds,
> since it never hits the disk. And grep -i uncatalog doc/src/sgml
> comes up empty. Where else should I be looking?

Huh. Okay, there probably isn't anyplace then. I'm surprised we didn't
list it in catalogs.sgml, though.

regards, tom lane