8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.53 2004/02/12 23:41:02 tgl Exp $
11
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.54 2004/05/05 17:06:56 tgl Exp $
12
12
*
13
13
* DESCRIPTION
14
14
* The "DefineFoo" routines take the parse tree and pick out the
@@ -1685,7 +1685,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
1685
1685
Form_pg_attribute pg_att ;
1686
1686
int ptr ;
1687
1687
1688
- /* Ignore dependees that aren't user columns oftables */
1688
+ /* Ignore dependees that aren't user columns ofrelations */
1689
1689
/* (we assume system columns are never of domain types) */
1690
1690
if (pg_depend -> classid != RelOid_pg_class ||
1691
1691
pg_depend -> objsubid <=0 )
@@ -1709,7 +1709,14 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
1709
1709
Relation rel ;
1710
1710
1711
1711
/* Acquire requested lock on relation */
1712
- rel = heap_open (pg_depend -> objid ,lockmode );
1712
+ rel = relation_open (pg_depend -> objid ,lockmode );
1713
+
1714
+ /* It could be a view or composite type; if so ignore it */
1715
+ if (rel -> rd_rel -> relkind != RELKIND_RELATION )
1716
+ {
1717
+ relation_close (rel ,lockmode );
1718
+ continue ;
1719
+ }
1713
1720
1714
1721
/* Build the RelToCheck entry with enough space for all atts */
1715
1722
rtc = (RelToCheck * )palloc (sizeof (RelToCheck ));