diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-06-02 18:37:57 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-06-02 18:37:57 -0400 |
commit | aff97b1f4e3630069a370be663b847c777b58319 (patch) | |
tree | 4c57371240a863cb9e1a5a83762334a108e8629c /src/backend | |
parent | 680ea6a6df345218f655eaad2c25f98900487438 (diff) | |
download | postgresql-aff97b1f4e3630069a370be663b847c777b58319.tar.gz postgresql-aff97b1f4e3630069a370be663b847c777b58319.zip |
Handle domains when checking for recursive inclusion of composite types.
We need this now because we allow domains over arrays, and we'll probably
allow domains over composites pretty soon, which makes the problem even
more obvious.
Although domains over arrays also exist in previous versions, this does not
need to be back-patched, because the coding used in older versions
successfully "looked through" domains over arrays. The problem is exposed
by not treating a domain as having a typelem.
Problem identified by Noah Misch, though I did not use his patch, since
it would require additional work to handle domains over composites that
way. This approach is more future-proof.
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/catalog/heap.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 71c99318343..86399571475 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -485,12 +485,19 @@ CheckAttributeType(const char *attname, errmsg("column \"%s\" has pseudo-type %s", attname, format_type_be(atttypid)))); } + else if (att_typtype == TYPTYPE_DOMAIN) + { + /* + * If it's a domain, recurse to check its base type. + */ + CheckAttributeType(attname, getBaseType(atttypid), attcollation, + containing_rowtypes, + allow_system_table_mods); + } else if (att_typtype == TYPTYPE_COMPOSITE) { /* - * For a composite type, recurse into its attributes. You might think - * this isn't necessary, but since we allow system catalogs to break - * the rule, we have to guard against the case. + * For a composite type, recurse into its attributes. */ Relation relation; TupleDesc tupdesc; |