mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Fix segmentation fault in MergeInheritedAttribute()
While converting a pg_attribute tuple into a ColumnDef, ColumnDef::compression remains NULL if there is no compression method set fot the attribute. Calling strcmp() with NULL ColumnDef::compression, when comparing compression methods of parents, causes segmentation fault in MergeInheritedAttribute(). Skip comparing compression methods if either of them is NULL. Author: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> Reported-by: Alexander Lakhin <exclusion@gmail.com> Discussion: https://www.postgresql.org/message-id/b22a6834-aacb-7b18-0424-a3f5fe889667%40gmail.com
This commit is contained in:
@ -3432,12 +3432,16 @@ MergeInheritedAttribute(List *inh_columns,
|
||||
*/
|
||||
if (prevdef->compression == NULL)
|
||||
prevdef->compression = newdef->compression;
|
||||
else if (strcmp(prevdef->compression, newdef->compression) != 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||
errmsg("column \"%s\" has a compression method conflict",
|
||||
attributeName),
|
||||
errdetail("%s versus %s", prevdef->compression, newdef->compression)));
|
||||
else if (newdef->compression != NULL)
|
||||
{
|
||||
if (strcmp(prevdef->compression, newdef->compression) != 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||
errmsg("column \"%s\" has a compression method conflict",
|
||||
attributeName),
|
||||
errdetail("%s versus %s",
|
||||
prevdef->compression, newdef->compression)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for GENERATED conflicts
|
||||
|
Reference in New Issue
Block a user