Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed fhrs:id out of integer range causes data updates to fail #29

Open
gregrs-uk opened this issue Sep 28, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@gregrs-uk
Copy link
Owner

gregrs-uk commented Sep 28, 2024

psql:/home/gregrs/fhodot/import/osm/post_import.sql:44: ERROR:  value "13012821017433" is out of range for type integer

Need to adapt here

INSERT INTO import.osm_fhrs_mapping
-- DISTINCT just in case an OSM object is linked to the same FHRS
-- establishment multiple times
SELECT DISTINCT
osm_id_single_space,
unnest(
CASE
-- check format of fhrs:id string
-- allow optional single space after semicolons
-- don't allow trailing semicolon
WHEN fhrs_ids_string ~ '^([0-9]+(; ?(?!$))?)+$'
THEN string_to_array(fhrs_ids_string, ';')
-- if invalid, create empty text array to unnest
ELSE '{}'::text[]
END
)::int AS fhrs_id
FROM import.osm;

See also #28

@gregrs-uk gregrs-uk added the bug Something isn't working label Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant