@@ -1919,6 +1919,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
1919
1919
def -> is_local = false;
1920
1920
def -> is_not_null = attribute -> attnotnull ;
1921
1921
def -> is_from_type = false;
1922
+ def -> is_from_parent = true;
1922
1923
def -> storage = attribute -> attstorage ;
1923
1924
def -> raw_default = NULL ;
1924
1925
def -> cooked_default = NULL ;
@@ -2206,11 +2207,20 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
2206
2207
* merge the column options into the column from the
2207
2208
* parent
2208
2209
*/
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 )));
2214
2224
}
2215
2225
prev = rest ;
2216
2226
rest = next ;
0 commit comments