1

I'm trying to use parse_address to parse client data and am finding that the split code "@" to tell it where to split address 1 and 2 gives erroneous results when used. If used, the street number is not parsed and stays in the street name field.

Query without street2 spit (street number works as expected):

SELECT num, street, street2, city, zip, zipplus FROM parse_address('1 Devonshire Place ATTN:AR DEPT, Boston,MA 02109-1234') AS a;

Results:

 num |            street             | street2 |  city  |  zip  | zipplus
-----+-------------------------------+---------+--------+-------+---------
 1   | Devonshire Place ATTN:AR DEPT |         | Boston | 02109 | 1234

Query with split used to get street2:

SELECT num, street, street2, city, zip, zipplus FROM parse_address('1 Devonshire Place @ATTN:AR DEPT, Boston, MA 02109-1234') AS a;

Results:

     num |       street       |   street2    |  city  |  zip  | zipplus
-----+--------------------+--------------+--------+-------+---------
         | 1 Devonshire Place | ATTN:AR DEPT | Boston | 02109 | 1234

Note the '1' does not parse into the num field as expected, while the street2 is parsed correctly.

I found the '@' to be used to split referenced in the repo. Is there an alternate manner to split the street2 and get num parsed?

VERSION INFO:

PostgreSQL 10.6 (Ubuntu 10.6-0ubuntu0.18.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0, 64-bit POSTGIS="2.4.3 r16312" PGSQL="100" GEOS="3.6.2-CAPI-1.10.2 4d2925d6" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.2.3, released 2017/11/20" LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.2.1" RASTER (1 row)

  • A more tangible example - '120 Bellamy Loop, Apt 26F, Bronx, NY 10475'. Same results; either the num is parsed and street = 'Bellamy Loop, Apt 26F' or I can split between 'Loop' and 'Apt' but then the 120 is lumped into the street result. – wedward Dec 17 '18 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.