From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | code question: rewriteDefine.c |
Date: | 2003-11-21 05:38:34 |
Message-ID: | 8765he8en9.fsf@mailbox.samurai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I noticed the following code in src/backend/rewrite/rewriteDefine.c,
circa line 390:
/*
* Are we converting a relation to a view?
*
* If so, check that the relation is empty because the storage
* for the relation is going to be deleted. Also insist that
* the rel not have any triggers, indexes, or child tables.
*/
if (event_relation->rd_rel->relkind != RELKIND_VIEW)
{
Under what circumstances do we "convert a relation to a view"? Is this
functionality exposed to the user?
Furthermore, it seems broken: it checks the pgclass.relhassubclass
attribute for this relation to see "if it has child tables", but this
is wrong, as relhassubclass only indicates that the relation MAY have
a subclass, not that is definitely does[1]. It also doesn't drop the
relation's TOAST table, if any, as the code itself notes.
-Neil
[1] This is because relhassubclass is not updated when a table's child
table is dropped, due to concurrency concerns; see has_subclass() in
plancat.c
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-11-21 06:20:53 | Re: Sponsoring enterprise features |
Previous Message | Tom Lane | 2003-11-21 04:47:37 | Re: PANIC: rename from /data/pg_xlog/0000002200000009 |