Skip to content

Commit 1899203

Browse files
committed
Fix get_rels_with_domain to not do the wrong thing with views and
composite types that use a domain.
1 parent c7007d1 commit 1899203

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/backend/commands/typecmds.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* 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 $
1212
*
1313
* DESCRIPTION
1414
* The "DefineFoo" routines take the parse tree and pick out the
@@ -1685,7 +1685,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
16851685
Form_pg_attribute pg_att;
16861686
int ptr;
16871687

1688-
/* Ignore dependees that aren't user columns of tables */
1688+
/* Ignore dependees that aren't user columns of relations */
16891689
/* (we assume system columns are never of domain types) */
16901690
if (pg_depend->classid != RelOid_pg_class ||
16911691
pg_depend->objsubid <= 0)
@@ -1709,7 +1709,14 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
17091709
Relation rel;
17101710

17111711
/* 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+
}
17131720

17141721
/* Build the RelToCheck entry with enough space for all atts */
17151722
rtc = (RelToCheck *) palloc(sizeof(RelToCheck));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy