forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in DSC-1105 (pull request DSpace#835)
[DSC-1105] Align imp framework sequences to pre existing Ids
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...ation/postgres/V7.6_2023.11.13__align_sequences_DBMSImportFramework2_with_current_ids.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,30 @@ | ||
-- | ||
-- The contents of this file are subject to the license and copyright | ||
-- detailed in the LICENSE and NOTICE files at the root of the source | ||
-- tree and available online at | ||
-- | ||
-- http://www.dspace.org/license/ | ||
-- | ||
|
||
----------------------------------------------------------------------------------- | ||
-- Create sequences for DBMS Import framework | ||
----------------------------------------------------------------------------------- | ||
do $$ | ||
begin | ||
|
||
SELECT pg_catalog.setval('imp_record_seq', (SELECT coalesce(MAX(imp_id),0) FROM imp_record)+1); | ||
|
||
SELECT pg_catalog.setval('imp_metadatavalue_seq', (SELECT coalesce(MAX(imp_metadatavalue_id),0) FROM imp_metadatavalue)+1); | ||
|
||
SELECT pg_catalog.setval('imp_bitstream_seq', (SELECT coalesce(MAX(imp_bitstream_id),0) FROM imp_bitstream)+1); | ||
|
||
SELECT pg_catalog.setval('imp_bitstream_metadatavalue_seq', (SELECT coalesce(MAX(imp_bitstream_metadatavalue_id),0) FROM imp_bitstream_metadatavalue)+1); | ||
|
||
exception when others then | ||
|
||
raise notice 'The transaction is in an uncommittable state. ' | ||
'Transaction was rolled back'; | ||
|
||
raise notice 'Rollback --> % %', SQLERRM, SQLSTATE; | ||
end; | ||
$$ language 'plpgsql'; |