Re: ALTER TYPE RENAME

From: Petr Jelinek <pjmodos(at)pjmodos(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: ALTER TYPE RENAME
Date: 2007-09-30 05:00:05
Message-ID: 46FF2D55.6040009@pjmodos.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane wrote:
> Hm, I'm not entirely sure if you got the point or not. For either
> relations or composite types, there is both a pg_class entry and a
> pg_type entry, and their names *must* stay in sync. We could allow
> people to rename both entries using either ALTER TABLE or ALTER TYPE,
> but the general consensus seems to be that ALTER TYPE should be used
> for composite types and ALTER TABLE for tables/views/etc. The fact
> that there's a pg_class entry for a composite type is really an
> implementation detail that would best not be exposed to users, so
> enforcing the use of the appropriate command seems reasonable to me.
>
> regards, tom lane
>
Yes, that's exactly what I meant (my language skills are not best).

Anyway, I am sending second version of the patch. Changes are:
- renamed TypeRename function to RenameTypeInternal and changed its
header comment
- throw error when using ALTER TYPE to rename rowtype
- split function renamerel to RenameRelation and RenameRelationInternal
where RenameRelation does permission checks and stuff and also checks if
it's not used for composite types and RenameRelationInternal does the
actual rename. And I also did a little cleanup in those functions
(removed unused code and changed some hardcoded relkind types to globaly
predefined constants)
- RenameType now calls RenameRelationInternal for composite types
(which calls RenameTypeInternal automatically)

Any other comments ?

--
Regards
Petr Jelinek (PJMODOS)

Attachment Content-Type Size
typerename2.diff text/plain 15.2 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2007-09-30 07:43:47 Re: set_ps_display during recovery
Previous Message Tom Lane 2007-09-30 04:34:37 Re: ALTER TYPE RENAME