]> granicus.if.org Git - postgis/commitdiff
rename function drop_national_tables_generate_script() to drop_nation_tables_generate...
authorRegina Obe <lr@pcorp.us>
Tue, 22 May 2012 13:25:48 +0000 (13:25 +0000)
committerRegina Obe <lr@pcorp.us>
Tue, 22 May 2012 13:25:48 +0000 (13:25 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9779 b70326c6-7e19-0410-871a-916f4a2858ee

extras/tiger_geocoder/tiger_2011/tiger_loader_2011.sql

index aa6882f2953c2398a34da04766392d97e680f6cc..07ca6319f22ab0bc823200433591abe2ac5323cc 100644 (file)
@@ -45,12 +45,13 @@ $$
   
 -- Helper function that generates script to drop all nation tables (county, state) in a particular schema 
 -- This is useful for loading 2011 because state and county tables aren't broken out into separate state files
-CREATE OR REPLACE FUNCTION drop_national_tables_generate_script(param_schema text DEFAULT 'tiger_data')
+DROP FUNCTION IF EXISTS drop_national_tables_generate_script(text);
+CREATE OR REPLACE FUNCTION drop_nation_tables_generate_script(param_schema text DEFAULT 'tiger_data')
   RETURNS text AS
 $$
 SELECT array_to_string(array_agg('DROP TABLE ' || quote_ident(table_schema) || '.' || quote_ident(table_name) || ';'),E'\n')
        FROM (SELECT * FROM information_schema.tables
-       WHERE table_schema = $1 AND (table_name ~ '^[a-z]{2}\_county' or table_name ~ '^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo; 
+       WHERE table_schema = $1 AND (table_name ~ E'^[a-z]{2}\_county' or table_name ~ E'^[a-z]{2}\_state' or table_name = 'state_all' or table_name LIKE 'county_all%') ORDER BY table_name) AS foo; 
 ;
 $$
   LANGUAGE sql VOLATILE;