summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorTom Lane2019-12-23 17:08:23 +0000
committerTom Lane2019-12-23 17:08:23 +0000
commitfc7695891d357a54f0258142de85f88520796b9b (patch)
treeee9cdf7330ed644d581dda10844912a0aeaa65c0 /src/backend
parent0fd8cfb20d2d41d4c2df021a5f355965fd8d21bc (diff)
Prevent a rowtype from being included in itself via a range.
We probably should have thought of this case when ranges were added, but we didn't. (It's not the fault of commit eb51af71f, because ranges didn't exist then.) It's an old bug, so back-patch to all supported branches. Discussion: https://postgr.es/m/7782.1577051475@sss.pgh.pa.us
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/catalog/heap.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 84049047109..ce5a5d741de 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -655,6 +655,15 @@ CheckAttributeType(const char *attname,
containing_rowtypes = list_delete_last(containing_rowtypes);
}
+ else if (att_typtype == TYPTYPE_RANGE)
+ {
+ /*
+ * If it's a range, recurse to check its subtype.
+ */
+ CheckAttributeType(attname, get_range_subtype(atttypid), attcollation,
+ containing_rowtypes,
+ flags);
+ }
else if (OidIsValid((att_typelem = get_element_type(atttypid))))
{
/*