Commit 2a738ccf authored by Darafei Praliaskouski's avatar Darafei Praliaskouski

Formatting: remove trailing whitespace from .sql files.


git-svn-id: http://svn.osgeo.org/postgis/trunk@16327 b70326c6-7e19-0410-871a-916f4a2858ee
parent 4d9dc037
Pipeline #16287879 passed with stage
in 18 minutes and 2 seconds
......@@ -5,7 +5,7 @@ SELECT ST_AsText(
ST_MakeLine(
ST_Point(25,45), ST_Point(25 + ST_Length('LINESTRING(25 45,75 100)'::Geometry) ,45))
); -- horizontal -- LINESTRING(25 45,99.33034 45)
-- control point
SELECT ST_AsText(
ST_SnapToGrid(
......@@ -23,7 +23,7 @@ SELECT ST_AsText(
ST_MakeLine(
ST_Point(75,100), ST_Point(75 + ST_Length('LINESTRING(25 45,75 100)'::Geometry) ,100))
); -- horizontal -- LINESTRING(75 100,149.33034 100)
-- control point
SELECT ST_AsText(
ST_SnapToGrid(
......@@ -34,4 +34,3 @@ SELECT ST_AsText(
-- LINESTRING(149.33034 100,148.97241 107.28565,147.90209 114.50113,146.12969 121.57695,143.67226 128.44498,140.55349 135.03907,136.8034 141.29571,132.4581 147.15465,127.55946 152.55946,122.15464 157.4581,116.29569 161.80338,110.03905 165.55347,103.44496 168.67223,96.57693 171.12965,89.5011 172.90205,82.28562 173.97236,74.99997 174.33027,67.71433 173.97235,60.49885 172.90203,53.42302 171.12962,46.55499 168.6722,39.96091 165.55342,33.70427 161.80333,27.84533 157.45804,22.44051 152.55939,17.54187 147.15457,13.19659 141.29563,9.44651 135.03898,6.32774 128.44489,3.87032 121.57686,2.09792 114.50103,1.02761 107.28555,0.6697 99.99991,1.02762 92.71426,2.09794 85.49878,3.87035 78.42295,6.32777 71.55493,9.44655 64.96084,13.19664 58.7042,17.54193 52.84526,22.44058 47.44045,25 45)
SELECT ST_AsText(ST_SnapToGrid(ST_CurveToLine('CIRCULARSTRING(149.33034 100, 136.8034 141.2957,25 45)',16),0.00001));
---------------------------------------------------------------------
-- Core types to access the PAGC address standardizer
-- Author: Stephen Woodbridge <woodbri@imaptools.com>
---------------------------------------------------------------------
CREATE TYPE stdaddr AS (
building text,
house_num text,
predir text,
qual text,
pretype text,
name text,
suftype text,
sufdir text,
ruralroute text,
extra text,
city text,
state text,
country text,
postcode text,
box text,
unit text
);
---------------------------------------------------------------------
-- Core types to access the PAGC address standardizer
-- Author: Stephen Woodbridge <woodbri@imaptools.com>
---------------------------------------------------------------------
CREATE TYPE stdaddr AS (
building text,
house_num text,
predir text,
qual text,
pretype text,
name text,
suftype text,
sufdir text,
ruralroute text,
extra text,
city text,
state text,
country text,
postcode text,
box text,
unit text
);
CREATE EXTENSION address_standardizer;
CREATE EXTENSION address_standardizer;
CREATE EXTENSION address_standardizer_data_us;
\ No newline at end of file
......@@ -7,64 +7,64 @@ create table test_parse_address (
outstring text
);
copy test_parse_address (instring, outstring) from stdin;
@@ sttype dirs dirs words$
@@ sttype dirs dirs words$
123 oak ln e n mycity ny (123,"oak ln e",,"123 oak ln e","n mycity",NY,,,US)
123 oak lane east n mycity ny (123,"oak lane east",,"123 oak lane east","n mycity",NY,,,US)
123 oak ln e north mycity ny (123,"oak ln e",,"123 oak ln e","north mycity",NY,,,US)
@@ sttype dirs dirs saint words$
@@ sttype dirs dirs saint words$
123 oak ln e n st marie ny (123,"oak ln e",,"123 oak ln e","n st marie",NY,,,US)
123 oak lane east n st marie ny (123,"oak lane east",,"123 oak lane east","n st marie",NY,,,US)
123 oak ln e north st marie ny (123,"oak ln e",,"123 oak ln e","north st marie",NY,,,US)
123 oak ln e n saint marie ny (123,"oak ln e",,"123 oak ln e","n saint marie",NY,,,US)
123 oak lane east n saint marie ny (123,"oak lane east",,"123 oak lane east","n saint marie",NY,,,US)
123 oak ln e north saint marie ny (123,"oak ln e",,"123 oak ln e","north saint marie",NY,,,US)
@@ sttype dirs saint words$
@@ sttype dirs saint words$
123 oak ln e st marie ny (123,"oak ln",,"123 oak ln","e st marie",NY,,,US)
123 oak lane east st marie ny (123,"oak lane",,"123 oak lane","east st marie",NY,,,US)
123 oak ln e st marie ny (123,"oak ln",,"123 oak ln","e st marie",NY,,,US)
123 oak ln e saint marie ny (123,"oak ln",,"123 oak ln","e saint marie",NY,,,US)
123 oak lane east saint marie ny (123,"oak lane",,"123 oak lane","east saint marie",NY,,,US)
123 oak ln e saint marie ny (123,"oak ln",,"123 oak ln","e saint marie",NY,,,US)
@@ sttype saint words$
@@ sttype saint words$
123 oak ln st marie ny (123,"oak ln",,"123 oak ln","st marie",NY,,,US)
123 oak lane st marie ny (123,"oak lane",,"123 oak lane","st marie",NY,,,US)
123 oak ln st marie ny (123,"oak ln",,"123 oak ln","st marie",NY,,,US)
123 oak ln saint marie ny (123,"oak ln",,"123 oak ln","saint marie",NY,,,US)
123 oak lane saint marie ny (123,"oak lane",,"123 oak lane","saint marie",NY,,,US)
123 oak ln saint marie ny (123,"oak ln",,"123 oak ln","saint marie",NY,,,US)
@@ sttype words$
@@ sttype words$
123 oak ln marie ny (123,"oak ln",,"123 oak ln",marie,NY,,,US)
123 oak ln new marie ny (123,"oak ln",,"123 oak ln","new marie",NY,,,US)
@@ === same as above but with commas ===
@@ sttype dirs dirs words$
@@ === same as above but with commas ===
@@ sttype dirs dirs words$
123 oak ln e, n mycity ny (123,"oak ln e",,"123 oak ln e","n mycity",NY,,,US)
123 oak lane east, n mycity ny (123,"oak lane east",,"123 oak lane east","n mycity",NY,,,US)
123 oak ln e, north mycity ny (123,"oak ln e",,"123 oak ln e","north mycity",NY,,,US)
123 oak ln e n, mycity ny (123,"oak ln e n",,"123 oak ln e n",mycity,NY,,,US)
123 oak lane east n, mycity ny (123,"oak lane east n",,"123 oak lane east n",mycity,NY,,,US)
123 oak ln e north, mycity ny (123,"oak ln e north",,"123 oak ln e north",mycity,NY,,,US)
@@ sttype dirs dirs saint words$
@@ sttype dirs dirs saint words$
123 oak ln e, n st marie ny (123,"oak ln e",,"123 oak ln e","n st marie",NY,,,US)
123 oak lane east, n st marie ny (123,"oak lane east",,"123 oak lane east","n st marie",NY,,,US)
123 oak ln e, north st marie ny (123,"oak ln e",,"123 oak ln e","north st marie",NY,,,US)
123 oak ln e, n saint marie ny (123,"oak ln e",,"123 oak ln e","n saint marie",NY,,,US)
123 oak lane east, n saint marie ny (123,"oak lane east",,"123 oak lane east","n saint marie",NY,,,US)
123 oak ln e, north saint marie ny (123,"oak ln e",,"123 oak ln e","north saint marie",NY,,,US)
@@ sttype dirs saint words$
@@ sttype dirs saint words$
123 oak ln e, st marie ny (123,"oak ln e",,"123 oak ln e","st marie",NY,,,US)
123 oak lane east, st marie ny (123,"oak lane east",,"123 oak lane east","st marie",NY,,,US)
123 oak ln e, st marie ny (123,"oak ln e",,"123 oak ln e","st marie",NY,,,US)
123 oak ln e, saint marie ny (123,"oak ln e",,"123 oak ln e","saint marie",NY,,,US)
123 oak lane east, saint marie ny (123,"oak lane east",,"123 oak lane east","saint marie",NY,,,US)
123 oak ln e, saint marie ny (123,"oak ln e",,"123 oak ln e","saint marie",NY,,,US)
@@ sttype saint words$
@@ sttype saint words$
123 oak ln, st marie ny (123,"oak ln",,"123 oak ln","st marie",NY,,,US)
123 oak lane, st marie ny (123,"oak lane",,"123 oak lane","st marie",NY,,,US)
123 oak ln, st marie ny (123,"oak ln",,"123 oak ln","st marie",NY,,,US)
123 oak ln, saint marie ny (123,"oak ln",,"123 oak ln","saint marie",NY,,,US)
123 oak lane, saint marie ny (123,"oak lane",,"123 oak lane","saint marie",NY,,,US)
123 oak ln, saint marie ny (123,"oak ln",,"123 oak ln","saint marie",NY,,,US)
@@ sttype words$
@@ sttype words$
123 oak ln, marie ny (123,"oak ln",,"123 oak ln",marie,NY,,,US)
123 oak ln, new marie ny (123,"oak ln",,"123 oak ln","new marie",NY,,,US)
\.
......
......@@ -2951,6 +2951,5 @@ INSERT INTO us_lex (seq, word, stdword, token) VALUES (1, 'ZERO', '0', 0);
INSERT INTO us_lex (seq, word, stdword, token) VALUES (1, 'ZERO', '0', 1);
INSERT INTO us_lex (seq, word, stdword, token) VALUES (1, 'ZNJA', 'ZANJA', 1);
-- needed set default back to original
ALTER TABLE us_lex ALTER COLUMN is_custom SET DEFAULT true;
......@@ -4378,6 +4378,5 @@ INSERT INTO us_rules (rule) VALUES ('0 3 1 2 22 -1 1 3 5 6 7 -1 1 17');
INSERT INTO us_rules (rule) VALUES ('0 1 6 -1 1 5 5 -1 1 9');
INSERT INTO us_rules (rule) VALUES ('-1');
-- needed so entries added by users will default to custom
ALTER TABLE us_rules ALTER COLUMN is_custom SET DEFAULT true;
......@@ -28,4 +28,3 @@ WHERE d.refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass
AND deptype = 'e' AND e.extname = 'postgis_tiger_geocoder'
ORDER BY sqladd;
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--
--
----
-- PostGIS - Spatial Types for PostgreSQL
-- http://postgis.net
......@@ -10,9 +10,9 @@
-- the terms of the GNU General Public Licence. See the COPYING file.
--
-- Author: Regina Obe <lr@pcorp.us>
--
--
-- This adds the tiger schema to search path
-- Functions in tiger are not schema qualified
-- Functions in tiger are not schema qualified
-- so this is needed for them to work
SELECT postgis_extension_AddToSearchPath('tiger');
......@@ -8,6 +8,6 @@ CREATE TYPE norm_addy AS (
location VARCHAR,
stateAbbrev VARCHAR,
zip VARCHAR,
parsed BOOLEAN,
zip4 varchar,
parsed BOOLEAN,
zip4 varchar,
address_alphanumeric varchar);
ALTER TYPE tiger.norm_addy ADD ATTRIBUTE zip4 varchar(4);
ALTER TYPE tiger.norm_addy ADD ATTRIBUTE zip4 varchar(4);
ALTER TYPE tiger.norm_addy ADD ATTRIBUTE address_alphanumeric varchar;
\ No newline at end of file
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--
--
----
-- PostGIS - Spatial Types for PostgreSQL
-- http://postgis.net
......@@ -10,10 +10,10 @@
-- the terms of the GNU General Public Licence. See the COPYING file.
--
-- Author: Regina Obe <lr@pcorp.us>
--
--
-- This drops extension helper functions
-- and should be called at the end of the extension upgrade file
-- removes all postgis_topology functions from postgis_topology extension since they will be readded
-- removes all postgis_topology functions from postgis_topology extension since they will be readded
-- during upgrade
SELECT postgis_extension_remove_objects('postgis_tiger_geocoder', 'FUNCTION');
SELECT postgis_extension_remove_objects('postgis_tiger_geocoder', 'AGGREGATE');
-- these introduced in PostGIS 2.4
DO language plpgsql
$$
BEGIN
ALTER TYPE tiger.norm_addy ADD ATTRIBUTE zip4 varchar;
ALTER TYPE tiger.norm_addy ADD ATTRIBUTE address_alphanumeric varchar;
EXCEPTION
WHEN others THEN -- ignore the error probably cause it already exists
END;
-- these introduced in PostGIS 2.4
DO language plpgsql
$$
BEGIN
ALTER TYPE tiger.norm_addy ADD ATTRIBUTE zip4 varchar;
ALTER TYPE tiger.norm_addy ADD ATTRIBUTE address_alphanumeric varchar;
EXCEPTION
WHEN others THEN -- ignore the error probably cause it already exists
END;
$$;
\ No newline at end of file
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--
--
----
-- PostGIS - Spatial Types for PostgreSQL
-- http://postgis.net
......@@ -10,10 +10,10 @@
-- the terms of the GNU General Public Licence. See the COPYING file.
--
-- Author: Regina Obe <lr@pcorp.us>
--
--
-- This drops extension helper functions
-- and should be called at the end of the extension upgrade file
-- removes all postgis_topology functions from postgis_topology extension since they will be readded
-- removes all postgis_topology functions from postgis_topology extension since they will be readded
-- during upgrade
SELECT postgis_extension_remove_objects('postgis_topology', 'FUNCTION');
SELECT postgis_extension_remove_objects('postgis_topology', 'AGGREGATE');
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--
--
--
-- PostGIS - Spatial Types for PostgreSQL
-- http://postgis.net
......@@ -7,7 +7,7 @@
--
-- This is free software; you can redistribute and/or modify it under
-- the terms of the GNU General Public Licence. See the COPYING file.
--
--
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#define CREATEFUNCTION CREATE OR REPLACE FUNCTION
......@@ -20,21 +20,20 @@
# define _VOLATILE_STRICT VOLATILE STRICT
# define _VOLATILE VOLATILE
# define _STRICT STRICT
#else
#else
# define _IMMUTABLE_STRICT with(iscachable,isstrict)
# define _IMMUTABLE with(iscachable)
# define _STABLE_STRICT with(isstrict)
# define _STABLE
# define _STABLE
# define _VOLATILE_STRICT with(isstrict)
# define _VOLATILE
# define _VOLATILE
# define _STRICT with(isstrict)
#endif
#endif
#if USE_VERSION >= 73
# define HAS_SCHEMAS 1
#endif
-----------------------------------------------------------------------
-- LONG TERM LOCKING
-----------------------------------------------------------------------
......@@ -63,7 +62,7 @@ END;
'
LANGUAGE 'plpgsql' _VOLATILE_STRICT;
-- LockRow([schema], table, rowid, auth, [expires])
-- LockRow([schema], table, rowid, auth, [expires])
-- Returns 1 if successfully obtained the lock, 0 otherwise
CREATEFUNCTION LockRow(text, text, text, text, timestamp)
RETURNS int
......@@ -77,14 +76,14 @@ DECLARE
ret int;
mytoid oid;
myrec RECORD;
BEGIN
IF NOT LongTransactionsEnabled() THEN
RAISE EXCEPTION ''Long transaction support disabled, use EnableLongTransaction() to enable.'';
END IF;
EXECUTE ''DELETE FROM authorization_table WHERE expires < now()'';
EXECUTE ''DELETE FROM authorization_table WHERE expires < now()'';
#ifdef HAS_SCHEMAS
SELECT c.oid INTO mytoid FROM pg_class c, pg_namespace n
......@@ -98,7 +97,7 @@ BEGIN
-- RAISE NOTICE ''toid: %'', mytoid;
FOR myrec IN SELECT * FROM authorization_table WHERE
FOR myrec IN SELECT * FROM authorization_table WHERE
toid = mytoid AND rid = myrid
LOOP
IF myrec.authid != authid THEN
......@@ -148,7 +147,6 @@ CREATEFUNCTION LockRow(text, text, text, timestamp)
#endif
LANGUAGE 'sql' _VOLATILE_STRICT;
CREATEFUNCTION AddAuth(text)
RETURNS BOOLEAN
AS '
......@@ -162,8 +160,8 @@ BEGIN
okay := ''f'';
FOR myrec IN SELECT * FROM pg_class WHERE relname = ''temp_lock_have_table'' LOOP
okay := ''t'';
END LOOP;
IF (okay <> ''t'') THEN
END LOOP;
IF (okay <> ''t'') THEN
CREATE TEMP TABLE temp_lock_have_table (transid xid, lockcode text);
-- this will only work from pgsql7.4 up
-- ON COMMIT DELETE ROWS;
......@@ -180,7 +178,6 @@ BEGIN
END;
'
LANGUAGE PLPGSQL;
-- CheckAuth( <schema>, <table>, <ridcolumn> )
--
......@@ -208,7 +205,7 @@ BEGIN
-- TODO: check for an already existing trigger ?
EXECUTE ''CREATE TRIGGER check_auth BEFORE UPDATE OR DELETE ON ''
EXECUTE ''CREATE TRIGGER check_auth BEFORE UPDATE OR DELETE ON ''
#ifdef HAS_SCHEMAS
|| quote_ident(schema) || ''.'' || quote_ident($2)
#else
......@@ -230,16 +227,15 @@ CREATEFUNCTION CheckAuth(text, text)
LANGUAGE 'SQL';
CREATEFUNCTION CheckAuthTrigger()
RETURNS trigger AS
RETURNS trigger AS
'@MODULE_FILENAME@', 'check_authorization'
LANGUAGE C;
CREATEFUNCTION GetTransactionID()
RETURNS xid AS
RETURNS xid AS
'@MODULE_FILENAME@', 'getTransactionID'
LANGUAGE C;
--
-- Enable Long transactions support
--
......@@ -325,7 +321,7 @@ LANGUAGE 'plpgsql';
--
-- Disable Long transactions support
--
-- (1) Drop any long_xact trigger
-- (1) Drop any long_xact trigger
-- (2) Drop the authorization_table
-- (3) KEEP the authorized_tables view
--
......
......@@ -40,7 +40,6 @@ BEGIN;
END;
BEGIN;
-- Add authorization for row 2
......
......@@ -18,7 +18,6 @@ language 'plpgsql';
--end build_history_table
--im open to suggestions for the names of the functions.
--just realized that one is build_history_table and the other create_...
CREATE OR REPLACE FUNCTION postgis_enable_history(p_schema text,p_table text,p_geometry_field text) returns boolean as
......@@ -55,7 +54,7 @@ BEGIN
v_srid:= (SELECT srid FROM public.geometry_columns WHERE f_table_schema = p_schema AND f_table_name = p_table AND f_geometry_column = p_geometry_field);
v_gid:= (SELECT column_name FROM information_schema.key_column_usage WHERE table_schema = p_schema AND table_name = p_table);
--end sql
--generate sql for creating the historic table
v_table_sql:= 'CREATE TABLE ' || v_history_table ||
'(' ||
......@@ -79,7 +78,7 @@ BEGIN
v_srid::text || ',' ||
quote_literal(v_geometry_type) || ');';
--end update geometry_columns
--insert into historic_tables
v_update_history_sql:='INSERT INTO public.historic_information(table_id,table_name,primary_field,geometry_field) VALUES (' ||
'DEFAULT,' ||
......@@ -98,7 +97,7 @@ BEGIN
execute _postgis_create_history_indexes(p_schema,p_table,p_geometry_field);
return true;
END
$$
language 'plpgsql';
......@@ -131,7 +130,7 @@ BEGIN
END
$$
language 'plpgsql';
language 'plpgsql';
--end add_insert_rule
--add_update_rule
......
......@@ -325,7 +325,6 @@ SELECT AddGeometryColumn('bridges','position','101','POINT','2');
-- ---------------------
-- -- !#@ ADAPTATION END
--
-- Streams
--
......
This diff is collapsed.
......@@ -35,7 +35,6 @@ BEGIN
END;
$_$ LANGUAGE plpgsql STABLE;
CREATE OR REPLACE FUNCTION geocode(
IN_ADDY NORM_ADDY,
max_results integer DEFAULT 10,
......
......@@ -245,7 +245,6 @@ BEGIN
RETURN;
END IF;
-- There are a couple of different things to try, from the highest preference and falling back
-- to lower-preference options.
-- We start out with zip-code matching, where the zip code could possibly be in more than one
......
......@@ -50,7 +50,7 @@ BEGIN
var_zip := array_agg(zip) FROM zip_lookup_base WHERE statefp = in_statefp AND lower(city) LIKE lower(in_city) || '%' ;
END IF;
IF var_debug THEN
RAISE NOTICE 'var_zip: %, city: %', quote_nullable(var_zip), quote_nullable(in_city);
RAISE NOTICE 'var_zip: %, city: %', quote_nullable(var_zip), quote_nullable(in_city);
END IF;
var_sql := '
WITH
......@@ -84,7 +84,7 @@ BEGIN
FROM (SELECT * FROM tiger.edges WHERE statefp = $1) AS e INNER JOIN a2 AS a ON (e.statefp = a.statefp AND a.tlid = e.tlid)
INNER JOIN e1 ON (e.statefp = e1.statefp
AND ARRAY[e.tnidf, e.tnidt] && ARRAY[e1.tnidf, e1.tnidt] )
WHERE (lower(e.fullname) = $7 or lower(a.name) LIKE $4 || ''%'')
ORDER BY CASE WHEN lower(a.name) = $4 THEN 0 ELSE 1 END + CASE WHEN lower(e.fullname) = $7 THEN 0 ELSE 1 END
LIMIT 5000
......
......@@ -67,13 +67,13 @@ BEGIN
FROM generate_series(1,ST_NPoints(road)) As i
WHERE part > ST_LineLocatePoint(road,ST_PointN(road,i))
ORDER BY i DESC;
IF npos < ST_NPoints(road) THEN
IF npos < ST_NPoints(road) THEN
az := ST_Azimuth (ST_PointN(road,npos), ST_PointN(road, npos + 1));
ELSE
az := ST_Azimuth (center_pt, ST_PointN(road, npos));
END IF;
END IF;
dir := CASE WHEN az < pi() THEN -1 ELSE 1 END;
--dir := 1;
var_dist := in_offset_m*CASE WHEN in_side = 'L' THEN -1 ELSE 1 END;
......
......@@ -46,7 +46,6 @@ $$
LANGUAGE sql IMMUTABLE
COST 5;
-- Generate script to drop all non-primary unique indexes on tiger and tiger_data tables
CREATE OR REPLACE FUNCTION drop_indexes_generate_script(tiger_data_schema text DEFAULT 'tiger_data')
RETURNS text AS
......@@ -199,7 +198,6 @@ ORDER BY 1), E'\r');
$$
LANGUAGE sql VOLATILE;
CREATE OR REPLACE FUNCTION install_missing_indexes() RETURNS boolean
AS
$$
......@@ -211,7 +209,6 @@ END
$$
language plpgsql;
CREATE OR REPLACE FUNCTION drop_dupe_featnames_generate_script() RETURNS text
AS
$$
......@@ -221,7 +218,7 @@ SELECT min(f.gid) As min_gid, f.tlid, lower(f.fullname) As fname
FROM ONLY ' || t.table_schema || '.' || t.table_name || ' As f
GROUP BY f.tlid, lower(f.fullname)
HAVING count(*) > 1;
DELETE FROM ' || t.table_schema || '.' || t.table_name || ' AS feat
WHERE EXISTS (SELECT tlid FROM dup WHERE feat.tlid = dup.tlid AND lower(feat.fullname) = dup.fname
AND feat.gid > dup.min_gid);
......
......@@ -40,8 +40,8 @@ BEGIN
, ('use_pagc_address_parser', 'false', 'boolean','normalize', 'If set to true, will try to use the address_standardizer extension (via pagc_normalize_address) instead of tiger normalize_address built on')
, ('zip_penalty', '2', 'numeric','rating', 'As input to rating will add (ref_zip - tar_zip)*zip_penalty where ref_zip is input address and tar_zip is a target address candidate')
) f(name,setting,unit,category,short_desc);
-- delete entries that are the same as default values
-- delete entries that are the same as default values
DELETE FROM geocode_settings As gc USING geocode_settings_default As gf WHERE gf.name = gc.name AND gf.setting = gc.setting;
END;
$$
......
......@@ -96,7 +96,7 @@ BEGIN
-- Assume that the address begins with a digit, and extract it from
-- the input string.
addressString := substring(rawInput from E'^([0-9].*?)[ ,/.]');
-- try to pull full street number including non-digits like 1R
result.address_alphanumeric := substring(rawInput from E'^([0-9a-zA-Z].*?)[ ,/.]');
......@@ -114,7 +114,7 @@ BEGIN
zipString := COALESCE(substring(rawInput from ws || '([0-9]{5})-[0-9]{0,4}$'),
substring(rawInput from ws || '([0-9]{2,5})$'),
substring(rawInput from ws || '([0-9]{6,14})$'));
result.zip4 := COALESCE(substring(rawInput from ws || '[0-9]{5}-([0-9]{0,4})$'),substring(rawInput from ws || '[0-9]{5}([0-9]{0,4})$'));
IF debug_flag THEN
......@@ -442,11 +442,10 @@ BEGIN
END IF;
END IF;
IF debug_flag THEN
raise notice '% reduced street: %', clock_timestamp(), reducedStreet;
END IF;
-- The pre direction should be at the beginning of the fullStreet string.
-- The post direction should be at the beginning of the location string
-- if there is no internal address
......
......@@ -20,7 +20,7 @@ BEGIN
RETURN NULL;
END IF;
result := COALESCE(input.address_alphanumeric, cull_null(input.address::text))
result := COALESCE(input.address_alphanumeric, cull_null(input.address::text))
|| COALESCE(' ' || input.preDirAbbrev, '')
|| CASE WHEN is_pretype(input.streetTypeAbbrev) THEN ' ' || input.streetTypeAbbrev ELSE '' END
|| COALESCE(' ' || input.streetName, '')
......
......@@ -35,7 +35,6 @@ END;
$$
language plpgsql;
SELECT install_pagc_tables();
DELETE FROM pagc_gaz WHERE is_custom = false;
DELETE FROM pagc_lex WHERE is_custom = false;
......@@ -3821,10 +3820,8 @@ INSERT INTO pagc_lex (id, seq, word, stdword, token, is_custom) VALUES (2935, 2,
INSERT INTO pagc_lex (id, seq, word, stdword, token, is_custom) VALUES (2936, 2, 'NORTH', 'NORTH', 1, false);
INSERT INTO pagc_lex (id, seq, word, stdword, token, is_custom) VALUES (2937, 2, 'SOUTH', 'SOUTH', 1, false);
SELECT pg_catalog.setval('pagc_lex_id_seq', (SELECT greatest((SELECT MAX(id) FROM pagc_lex),50000)), true);
-- set default to false so all we input will be treated as no custom --
ALTER TABLE tiger.pagc_rules ALTER COLUMN is_custom SET DEFAULT false;
INSERT INTO pagc_rules (id, rule) VALUES (1, '1 -1 5 -1 2 7');
......
......@@ -71,7 +71,6 @@ SELECT '#1074b' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(S
SELECT '#1070a' As ticket, pprint_addy(addy) As address, ST_AsText(ST_SnapToGrid(geomout,0.00001)) As pt, rating FROM geocode('100 Federal Street, Boston, MA 02109',3, (SELECT ST_Union(the_geom) FROM place WHERE statefp = '25' AND name = 'Lynn')::geometry);
SELECT '#1070b' As ticket, pprint_addy(addy) As address, ST_AsText(ST_SnapToGrid(geomout,0.00001)) As pt, rating FROM geocode('100 Federal Street, MA',3, (SELECT ST_Union(the_geom) FROM place WHERE statefp = '25' AND name = 'Lynn')::geometry);
-- service roads and interstates
SELECT '#1112a' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,2) As g, target FROM (SELECT '8401 W 35W Service Dr NE, Blaine, MN 55449'::text As target) As f) As foo;
SELECT '#1112b' As ticket, pprint_addy((g).addy) As address, target, ST_AsText(ST_SnapToGrid((g).geomout, 0.00001)) As pt, (g).rating FROM (SELECT geocode(target,1) As g, target FROM (SELECT '8401 35W, Blaine, MN 55449'::text As target) As f) As foo;
......
......@@ -33,8 +33,6 @@ INSERT INTO direction_lookup (name, abbrev) VALUES('EAST', 'E');
INSERT INTO direction_lookup (name, abbrev) VALUES('E', 'E');
CREATE INDEX direction_lookup_abbrev_idx ON direction_lookup (abbrev);
-- Create secondary unit lookup table
DROP TABLE IF EXISTS tiger.secondary_unit_lookup;
CREATE TABLE secondary_unit_lookup (name VARCHAR(20) PRIMARY KEY, abbrev VARCHAR(5));
......@@ -79,8 +77,6 @@ INSERT INTO secondary_unit_lookup (name, abbrev) VALUES ('UPPER', 'UPPR');
INSERT INTO secondary_unit_lookup (name, abbrev) VALUES ('UPPR', 'UPPR');
CREATE INDEX secondary_unit_lookup_abbrev_idx ON secondary_unit_lookup (abbrev);
-- Create state lookup table
DROP TABLE IF EXISTS tiger.state_lookup;
CREATE TABLE state_lookup (st_code INTEGER PRIMARY KEY, name VARCHAR(40) UNIQUE, abbrev VARCHAR(3) UNIQUE, statefp char(2) UNIQUE);
......@@ -146,7 +142,6 @@ INSERT INTO state_lookup (name, abbrev, st_code) VALUES ('Wyoming', 'WY', '56');
-- NOTE: fix later -- this is wrong for those - state code ones
UPDATE state_lookup SET statefp = lpad(st_code::text,2,'0');