Please find the attached patch to fix the RM #2318: Foreign Table create script puts columns in alphabetical order instead of the actual order of the columns as the table was originally created
Fixed the column order in get_columns.sql template for PG 9.5 and above. Other than this templates have the correct order.