This repository was archived by the owner on Jan 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added code to set parentNumber to numeric value of longest numeric su…
…bstring of parent corp name if parent number is not already set. Fixes issue where preassigned corporate IDs loaded via SDF Bulk Loader do not get parent numbers properly assigned, and thus cannot be searched on by raw numbers in Compound Reg Search.
- Loading branch information
Showing
4 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
7 changes: 7 additions & 0 deletions
7
src/main/resources/db/migration/postgres/V1.2.2.0__fill_in_parent_number.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
UPDATE parent SET parent_number = new_parent_number FROM ( | ||
SELECT corp_name, parent_number, ordered_nums[1]::bigint as new_parent_number FROM ( | ||
SELECT corp_name, parent_number, array_agg(parsed_corp_number order by length(parsed_corp_number) DESC) as ordered_nums from ( | ||
select corp_name, parent_number, regexp_split_to_table(corp_name, '[^0-9]') as parsed_corp_number | ||
from parent) a | ||
group by corp_name, parent_number) b) c | ||
WHERE c.corp_name = parent.corp_name AND parent.parent_number = 0; |
This file contains 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