Commit 1899203f authored by Tom Lane's avatar Tom Lane

Fix get_rels_with_domain to not do the wrong thing with views and

composite types that use a domain.
parent c7007d18
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.53 2004/02/12 23:41:02 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.54 2004/05/05 17:06:56 tgl Exp $
* *
* DESCRIPTION * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * The "DefineFoo" routines take the parse tree and pick out the
...@@ -1685,7 +1685,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode) ...@@ -1685,7 +1685,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
Form_pg_attribute pg_att; Form_pg_attribute pg_att;
int ptr; int ptr;
/* Ignore dependees that aren't user columns of tables */ /* Ignore dependees that aren't user columns of relations */
/* (we assume system columns are never of domain types) */ /* (we assume system columns are never of domain types) */
if (pg_depend->classid != RelOid_pg_class || if (pg_depend->classid != RelOid_pg_class ||
pg_depend->objsubid <= 0) pg_depend->objsubid <= 0)
...@@ -1709,7 +1709,14 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode) ...@@ -1709,7 +1709,14 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
Relation rel; Relation rel;
/* Acquire requested lock on relation */ /* Acquire requested lock on relation */
rel = heap_open(pg_depend->objid, lockmode); rel = relation_open(pg_depend->objid, lockmode);
/* It could be a view or composite type; if so ignore it */
if (rel->rd_rel->relkind != RELKIND_RELATION)
{
relation_close(rel, lockmode);
continue;
}
/* Build the RelToCheck entry with enough space for all atts */ /* Build the RelToCheck entry with enough space for all atts */
rtc = (RelToCheck *) palloc(sizeof(RelToCheck)); rtc = (RelToCheck *) palloc(sizeof(RelToCheck));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment