[postgis-tickets] r14316 - addresses #3347 force order of staged insert columns to be in table column order

Regina Obe lr at pcorp.us
Sat Oct 24 15:11:40 PDT 2015


Author: robe
Date: 2015-10-24 15:11:40 -0700 (Sat, 24 Oct 2015)
New Revision: 14316

Modified:
   trunk/extras/tiger_geocoder/tiger_loader_2013.sql
   trunk/extras/tiger_geocoder/tiger_loader_2014.sql
   trunk/extras/tiger_geocoder/tiger_loader_2015.sql
Log:
addresses #3347 force order of staged insert columns to be in table column order

Modified: trunk/extras/tiger_geocoder/tiger_loader_2013.sql
===================================================================
--- trunk/extras/tiger_geocoder/tiger_loader_2013.sql	2015-10-24 22:11:00 UTC (rev 14315)
+++ trunk/extras/tiger_geocoder/tiger_loader_2013.sql	2015-10-24 22:11:40 UTC (rev 14316)
@@ -373,12 +373,14 @@
 				FROM information_schema.columns 
 				 WHERE table_name = param_target_table
 					AND table_schema = var_data_schema 
-					AND column_name <> ALL(param_columns_exclude) ), ',') || ') SELECT ' 
+					AND column_name <> ALL(param_columns_exclude) 
+                    ORDER BY ordinal_position ), ',') || ') SELECT ' 
 					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
 				FROM information_schema.columns 
 				 WHERE table_name = param_staging_table
 					AND table_schema = var_staging_schema 
-					AND column_name <> ALL( param_columns_exclude) ), ',') ||' FROM ' 
+					AND column_name <> ALL( param_columns_exclude) 
+                    ORDER BY ordinal_position ), ',') ||' FROM ' 
 					|| var_staging_schema || '.' || param_staging_table || ';';
 	RAISE NOTICE '%', var_sql;
 	EXECUTE (var_sql);

Modified: trunk/extras/tiger_geocoder/tiger_loader_2014.sql
===================================================================
--- trunk/extras/tiger_geocoder/tiger_loader_2014.sql	2015-10-24 22:11:00 UTC (rev 14315)
+++ trunk/extras/tiger_geocoder/tiger_loader_2014.sql	2015-10-24 22:11:40 UTC (rev 14316)
@@ -486,12 +486,14 @@
 				FROM information_schema.columns 
 				 WHERE table_name = param_target_table
 					AND table_schema = var_data_schema 
-					AND column_name <> ALL(param_columns_exclude) ), ',') || ') SELECT ' 
+					AND column_name <> ALL(param_columns_exclude) 
+                    ORDER BY ordinal_position ), ',') || ') SELECT ' 
 					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
 				FROM information_schema.columns 
 				 WHERE table_name = param_staging_table
 					AND table_schema = var_staging_schema 
-					AND column_name <> ALL( param_columns_exclude) ), ',') ||' FROM ' 
+					AND column_name <> ALL( param_columns_exclude) 
+                    ORDER BY ordinal_position ), ',') ||' FROM ' 
 					|| var_staging_schema || '.' || param_staging_table || ';';
 	RAISE NOTICE '%', var_sql;
 	EXECUTE (var_sql);

Modified: trunk/extras/tiger_geocoder/tiger_loader_2015.sql
===================================================================
--- trunk/extras/tiger_geocoder/tiger_loader_2015.sql	2015-10-24 22:11:00 UTC (rev 14315)
+++ trunk/extras/tiger_geocoder/tiger_loader_2015.sql	2015-10-24 22:11:40 UTC (rev 14316)
@@ -486,12 +486,14 @@
 				FROM information_schema.columns 
 				 WHERE table_name = param_target_table
 					AND table_schema = var_data_schema 
-					AND column_name <> ALL(param_columns_exclude) ), ',') || ') SELECT ' 
+					AND column_name <> ALL(param_columns_exclude) 
+                    ORDER BY ordinal_position ), ',') || ') SELECT ' 
 					|| array_to_string(ARRAY(SELECT quote_ident(column_name::text) 
 				FROM information_schema.columns 
 				 WHERE table_name = param_staging_table
 					AND table_schema = var_staging_schema 
-					AND column_name <> ALL( param_columns_exclude) ), ',') ||' FROM ' 
+					AND column_name <> ALL( param_columns_exclude) 
+                    ORDER BY ordinal_position ), ',') ||' FROM ' 
 					|| var_staging_schema || '.' || param_staging_table || ';';
 	RAISE NOTICE '%', var_sql;
 	EXECUTE (var_sql);



More information about the postgis-tickets mailing list