@@ -1756,12 +1756,16 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
1756
1756
*/
1757
1757
if (inhSchema != NIL )
1758
1758
{
1759
+ int schema_attno = 0 ;
1760
+
1759
1761
foreach (entry ,schema )
1760
1762
{
1761
1763
ColumnDef * newdef = lfirst (entry );
1762
1764
char * attributeName = newdef -> colname ;
1763
1765
int exist_attno ;
1764
1766
1767
+ schema_attno ++ ;
1768
+
1765
1769
/*
1766
1770
* Does it conflict with some previously inherited column?
1767
1771
*/
@@ -1780,9 +1784,14 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
1780
1784
* Yes, try to merge the two column definitions. They must
1781
1785
* have the same type, typmod, and collation.
1782
1786
*/
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." )));
1786
1795
def = (ColumnDef * )list_nth (inhSchema ,exist_attno - 1 );
1787
1796
typenameTypeIdAndMod (NULL ,def -> typeName ,& defTypeId ,& deftypmod );
1788
1797
typenameTypeIdAndMod (NULL ,newdef -> typeName ,& newTypeId ,& newtypmod );