1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-22 21:53:06 +03:00

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
This commit is contained in:
Tom Lane
2019-12-23 12:08:24 -05:00
parent 365052abbc
commit 6609c3ad98
3 changed files with 44 additions and 0 deletions

View File

@@ -563,6 +563,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,
allow_system_table_mods);
}
else if (OidIsValid((att_typelem = get_element_type(atttypid))))
{
/*