Opened 9 years ago
Closed 8 years ago
#3451 closed defect (fixed)
Schema-qualify table names to avoid search path confusion or "column does not exist" error
Reported by: | mst | Owned by: | robe |
---|---|---|---|
Priority: | critical | Milestone: | PostGIS 2.2.3 |
Component: | tiger geocoder | Version: | 2.2.x |
Keywords: | table name, column does not exist, schema | Cc: |
Description
At least some functions do not appear to schema-qualify table names and end up referencing the wrong table. This results in an error stating a column does not exist:
ERROR: column co.statefp does not exist LINE 2: ...cefp = p.placefp) LEFT JOIN county co ON ('25' = co.statefp... ^ CONTEXT: PL/pgSQL function geocode_address(norm_addy,integer,geometry) line 383 at FOR over EXECUTE statement PL/pgSQL function geocode(norm_addy,integer,geometry) line 14 at FOR over SELECT rows PL/pgSQL function geocode(character varying,integer,geometry) line 26 at RETURN QUERY
In this case, the county table existed in another schema in the search path. Other table names used in the tiger and tiger_data schemas may also be in use (such as state, place, addr, zip_lookup, zip_state, etc. as well as their state-prefixed counterparts ma_place, id_addr, etc.). Schema-qualifying all table names should avoid this issue.
Attachments (1)
Change History (8)
by , 9 years ago
Attachment: | geocode_error_column_does_not_exist.txt added |
---|
comment:1 by , 9 years ago
Some addresses may not get located, returning the error. Original assumption that this was only a problem with unlocatable addresses appeared not to be the case. Renaming the other county table in the database allowed more locations and null values to be correctly returned.
comment:3 by , 9 years ago
Priority: | medium → critical |
---|
comment:4 by , 9 years ago
Milestone: | PostGIS 2.2.2 → PostGIS 2.2.3 |
---|
comment:5 by , 9 years ago
comment:6 by , 9 years ago
comment:7 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I think I took care of most of these at least important ones.
Full PostgreSQL error output (attemped formatting for legibility)