Add function to fill the contextes_projets table - #2
Open
Elioooooott wants to merge 6 commits into
Open
Conversation
Elioooooott
commented
Aug 7, 2026
Contributor
- Add function to fill the contextes_projets table with the contexts that intersect with the project
- Replace the "cree_par" and "modifie_par" columns with "login"
- Fix the SQL function for importing context data and add type validation
Replace useless column "cree_par" "modifie_par" by "login" . Add data type verification to the function "import_data_from_temporary_table".
Elioooooott
force-pushed
the
fill-project-contexts
branch
from
August 10, 2026 09:48
ebe2fc3 to
e4b9c75
Compare
…s not been imported yet
Elioooooott
marked this pull request as ready for review
August 31, 2026 08:22
mdouchin
requested changes
Aug 31, 2026
mdouchin
left a comment
There was a problem hiding this comment.
Looks good to me. Small changes needed
Comment on lines
+58
to
+79
| EXECUTE format( | ||
| $SQL$ | ||
| INSERT INTO desimper.contextes_projets | ||
| (fk_id_projet, geom, code_contexte, id_objet_contexte, surface_m, login) | ||
| SELECT | ||
| $1, | ||
| ST_Multi(ST_CollectionExtract(ST_MakeValid(valid_contexts.geom), 3)), | ||
| $2, | ||
| valid_contexts.id, | ||
| ST_Area(valid_contexts.geom), | ||
| 'login fonction fill_contextes_projets' | ||
| FROM ( | ||
| SELECT c.id AS id, | ||
| ST_Multi(ST_CollectionExtract(ST_Intersection($3, ST_MakeValid(c.geom)), 3)) AS geom | ||
| FROM %I.%I AS c | ||
| WHERE ST_Intersects(c.geom, $3) | ||
| ) AS valid_contexts | ||
| WHERE NOT ST_IsEmpty(valid_contexts.geom) | ||
| $SQL$, | ||
| contexte.nom_schema, contexte.nom_table | ||
| ) | ||
| USING id_projet, contexte.code, geom_projet; |
There was a problem hiding this comment.
- Please use only parameters inside the
formatmethod and avoid using alsoUSING - Please use %L and not %s
- Use also number to better identify each parameter, ex
%1$L
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.