Index: src/backend/commands/alter.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/alter.c,v
retrieving revision 1.14
diff -c -b -B -r1.14 alter.c
*** src/backend/commands/alter.c	1 Aug 2005 04:03:55 -0000	1.14
--- src/backend/commands/alter.c	3 Aug 2005 23:16:31 -0000
***************
*** 224,230 ****
  
  		case OBJECT_TYPE:
  		case OBJECT_DOMAIN:		/* same as TYPE */
! 			AlterTypeOwner(stmt->object, newowner);
  			break;
  
  		default:
--- 224,230 ----
  
  		case OBJECT_TYPE:
  		case OBJECT_DOMAIN:		/* same as TYPE */
! 			AlterTypeOwner(stmt->object, newowner, true);
  			break;
  
  		default:
Index: src/backend/commands/tablecmds.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/tablecmds.c,v
retrieving revision 1.165
diff -c -b -B -r1.165 tablecmds.c
*** src/backend/commands/tablecmds.c	1 Aug 2005 04:03:55 -0000	1.165
--- src/backend/commands/tablecmds.c	3 Aug 2005 23:16:42 -0000
***************
*** 5295,5300 ****
--- 5295,5302 ----
  		HeapTuple	newtuple;
  		Oid		    namespaceOid = tuple_class->relnamespace;
  		AclResult	aclresult;
+ 		List *typename = list_make1(makeString(get_namespace_name(namespaceOid)));			
+ 		typename = lappend(typename, makeString(NameStr(tuple_class->relname)));
  
  		/* Otherwise, must be owner of the existing object */
  		if (!pg_class_ownercheck(relationOid,GetUserId()))
***************
*** 5371,5376 ****
--- 5373,5384 ----
  
  			/* If it has dependent sequences, recurse to change them too */
  			change_owner_recurse_to_sequences(relationOid, newOwnerId);
+ 
+ 			/* the table row type should be changed, too */
+ 			AlterTypeOwner(typename, newOwnerId, false);
+ 		} else if ( tuple_class->relkind == RELKIND_SEQUENCE ) {
+ 			/* the sequence row type should be changed, too */
+ 			AlterTypeOwner(typename, newOwnerId, false);
  		}
  	}
  
Index: src/backend/commands/typecmds.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/commands/typecmds.c,v
retrieving revision 1.77
diff -c -b -B -r1.77 typecmds.c
*** src/backend/commands/typecmds.c	1 Aug 2005 04:03:55 -0000	1.77
--- src/backend/commands/typecmds.c	3 Aug 2005 23:16:46 -0000
***************
*** 2019,2025 ****
   * Change the owner of a type.
   */
  void
! AlterTypeOwner(List *names, Oid newOwnerId)
  {
  	TypeName   *typename;
  	Oid			typeOid;
--- 2019,2025 ----
   * Change the owner of a type.
   */
  void
! AlterTypeOwner(List *names, Oid newOwnerId, bool errorOnTableType)
  {
  	TypeName   *typename;
  	Oid			typeOid;
***************
*** 2057,2063 ****
  	 * free-standing composite type, and not a table's underlying type. We
  	 * want people to use ALTER TABLE not ALTER TYPE for that case.
  	 */
! 	if (typTup->typtype == 'c' && get_rel_relkind(typTup->typrelid) != 'c')
  		ereport(ERROR,
  				(errcode(ERRCODE_WRONG_OBJECT_TYPE),
  				 errmsg("\"%s\" is a table's row type",
--- 2057,2064 ----
  	 * free-standing composite type, and not a table's underlying type. We
  	 * want people to use ALTER TABLE not ALTER TYPE for that case.
  	 */
! 	if (typTup->typtype == 'c' && get_rel_relkind(typTup->typrelid) != 'c'
! 		&& errorOnTableType)
  		ereport(ERROR,
  				(errcode(ERRCODE_WRONG_OBJECT_TYPE),
  				 errmsg("\"%s\" is a table's row type",
Index: src/include/commands/typecmds.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/commands/typecmds.h,v
retrieving revision 1.12
diff -c -b -B -r1.12 typecmds.h
*** src/include/commands/typecmds.h	1 Aug 2005 04:03:58 -0000	1.12
--- src/include/commands/typecmds.h	3 Aug 2005 23:16:50 -0000
***************
*** 34,40 ****
  
  extern List *GetDomainConstraints(Oid typeOid);
  
! extern void AlterTypeOwner(List *names, Oid newOwnerId);
  extern void AlterTypeNamespace(List *names, const char *newschema);
  extern void AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
  									   bool errorOnTableType);
--- 34,40 ----
  
  extern List *GetDomainConstraints(Oid typeOid);
  
! extern void AlterTypeOwner(List *names, Oid newOwnerId, bool errorOnTableType);
  extern void AlterTypeNamespace(List *names, const char *newschema);
  extern void AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
  									   bool errorOnTableType);
