Hi,

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.

Thanks,
Khushboo
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/get_columns.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/get_columns.sql
index 3417208..6e82a09 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/get_columns.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.5_plus/get_columns.sql
@@ -40,4 +40,4 @@ LEFT OUTER JOIN
 WHERE
     att.attrelid={{foid}}::oid
     AND att.attnum>0
-    ORDER BY att.attname;
+    ORDER BY att.attnum;
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to