@@ -1756,12 +1756,16 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
17561756 */
17571757if (inhSchema != NIL )
17581758{
1759+ int schema_attno = 0 ;
1760+
17591761foreach (entry ,schema )
17601762{
17611763ColumnDef * newdef = lfirst (entry );
17621764char * attributeName = newdef -> colname ;
17631765int exist_attno ;
17641766
1767+ schema_attno ++ ;
1768+
17651769/*
17661770 * Does it conflict with some previously inherited column?
17671771 */
@@ -1780,9 +1784,14 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
17801784 * Yes, try to merge the two column definitions. They must
17811785 * have the same type, typmod, and collation.
17821786 */
1783- ereport (NOTICE ,
1784- (errmsg ("merging column \"%s\" with inherited definition" ,
1785- attributeName )));
1787+ if (exist_attno == schema_attno )
1788+ ereport (NOTICE ,
1789+ (errmsg ("merging column \"%s\" with inherited definition" ,
1790+ attributeName )));
1791+ else
1792+ ereport (NOTICE ,
1793+ (errmsg ("moving and merging column \"%s\" with inherited definition" ,attributeName ),
1794+ errdetail ("User-specified column moved to the position of the inherited column." )));
17861795def = (ColumnDef * )list_nth (inhSchema ,exist_attno - 1 );
17871796typenameTypeIdAndMod (NULL ,def -> typeName ,& defTypeId ,& deftypmod );
17881797typenameTypeIdAndMod (NULL ,newdef -> typeName ,& newTypeId ,& newtypmod );