From: Regina Obe Date: Tue, 22 May 2012 13:25:48 +0000 (+0000) Subject: rename function drop_national_tables_generate_script() to drop_nation_tables_generate... X-Git-Tag: 2.1.0beta2~1004 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=307b6251dfd28238fe75866643b8961ba96861ef;p=postgis rename function drop_national_tables_generate_script() to drop_nation_tables_generate_script(), revise regex to prevent psql warning in 9.2 psql git-svn-id: http://svn.osgeo.org/postgis/trunk@9779 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/extras/tiger_geocoder/tiger_2011/tiger_loader_2011.sql b/extras/tiger_geocoder/tiger_2011/tiger_loader_2011.sql index aa6882f29..07ca6319f 100644 --- a/extras/tiger_geocoder/tiger_2011/tiger_loader_2011.sql +++ b/extras/tiger_geocoder/tiger_2011/tiger_loader_2011.sql @@ -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;