diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2019-12-23 12:08:23 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2019-12-23 12:08:23 -0500 |
commit | 976cb11f6c58b8807455982ae7344b72ea2cd1ab (patch) | |
tree | 9763a1ffb6459c19ff3d26eb42c520270f8d11eb /src/backend | |
parent | e1c056cc4d7bcc0dfe8a3808550e7b7f73b64643 (diff) | |
download | postgresql-976cb11f6c58b8807455982ae7344b72ea2cd1ab.tar.gz postgresql-976cb11f6c58b8807455982ae7344b72ea2cd1ab.zip |
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.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 1c367527672..32dceb72786 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -656,6 +656,15 @@ CheckAttributeType(const char *attname, containing_rowtypes = list_delete_first(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)))) { /* |