@@ -1919,6 +1919,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
19191919 def -> is_local = false;
19201920 def -> is_not_null = attribute -> attnotnull ;
19211921 def -> is_from_type = false;
1922+ def -> is_from_parent = true;
19221923 def -> storage = attribute -> attstorage ;
19231924 def -> raw_default = NULL ;
19241925 def -> cooked_default = NULL ;
@@ -2206,11 +2207,20 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
22062207 * merge the column options into the column from the
22072208 * parent
22082209 */
2209- coldef -> is_not_null = restdef -> is_not_null ;
2210- coldef -> raw_default = restdef -> raw_default ;
2211- coldef -> cooked_default = restdef -> cooked_default ;
2212- coldef -> constraints = restdef -> constraints ;
2213- list_delete_cell (schema , rest , prev );
2210+ if (coldef -> is_from_parent )
2211+ {
2212+ coldef -> is_not_null = restdef -> is_not_null ;
2213+ coldef -> raw_default = restdef -> raw_default ;
2214+ coldef -> cooked_default = restdef -> cooked_default ;
2215+ coldef -> constraints = restdef -> constraints ;
2216+ coldef -> is_from_parent = false;
2217+ list_delete_cell (schema , rest , prev );
2218+ }
2219+ else
2220+ ereport (ERROR ,
2221+ (errcode (ERRCODE_DUPLICATE_COLUMN ),
2222+ errmsg ("column \"%s\" specified more than once" ,
2223+ coldef -> colname )));
22142224 }
22152225 prev = rest ;
22162226 rest = next ;
0 commit comments