Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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: typerename2.diff
Description: text/plain (15.2 KB)

In response to

Responses

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group