Skip to content
New issue

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

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

Already on GitHub? # to your account

Set pipe year check >= 1800 instead > 1800 and add some verbosity in init_qwat.sh #366

Merged
merged 5 commits into from
Nov 18, 2022

Conversation

@nicolas-sitylb nicolas-sitylb changed the title Dev Set pipe year check >= 1800 instead > 1800 and add some verbosity in init_qwat.sh Sep 13, 2022
@ponceta
Copy link
Member

ponceta commented Nov 11, 2022

A delta is required with this code :

ALTER TABLE qwat_od.pipe DROP CONSTRAINT pipe_year_check ;

ALTER TABLE qwat_od.pipe ADD CONSTRAINT pipe_year_check CHECK (year IS NULL OR year >= 1800 AND (year <= EXTRACT(YEAR FROM NOW()) OR fk_status = 1306 AND year - 50 <= EXTRACT(YEAR FROM NOW())));

https://stackoverflow.com/questions/13244889/how-to-alter-constraint

@olivierdalang
Copy link
Collaborator

Hmm pum check should have failed without the delta, no ?

@ponceta
Copy link
Member

ponceta commented Nov 11, 2022

To my knowledge, pum check the existence but not the syntax of constraints.

See :

https://github.com/opengisch/pum/blob/master/pum/core/checker.py#L178

@olivierdalang
Copy link
Collaborator

Ok, opened an issue here : opengisch/pum#103

IMO worth looking into as there may be inconsistencies in constraints btw the datamodel and an upgraded datamodel, which could be serious in terms of data integrity

@ponceta ponceta merged commit 94dc562 into qwat:master Nov 18, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pipes with a year < 1801 raises a PostGIS error: violation of pipe_year_check constraint
3 participants