BEGIN; SELECT plan(2); ---------------------------------- -- -- Setup Test environment and data -- ---------------------------------- -- test records to dedupe and containers: -- bib 60500 (source) -- bib 60501 (target) -- -- create bib 60,500 INSERT into biblio.record_entry (id, marc, last_xact_id) VALUES (60500, $$ 01938cam a2200337Ii 4500827439320170831142031.0170522s2017 mauaf e 000 1 eng d9781328791825(hardcover)1328791823(hardcover)(OCoLC)987617974823/.91223Tolkien, J. R. R.(John Ronald Reuel),1892-1973,author.Beren and Lúthien /by J.R.R. Tolkien ; edited by Christopher Tolkien ; with illustrations by Alan Lee.First U.S. edition.Boston :Houghton Mifflin Harcourt,2017.288 pages, 9 unnumbered leaves of plates :illustrations (some color) ;22 cm. $$, 'PGTAP' ); -- create bib 60,501 INSERT into biblio.record_entry (id, marc, last_xact_id) VALUES (60501, $$ 01938cam a2200337Ii 4500827439220170831142031.0170522s2017 mauaf e 000 1 eng d9781328791825(hardcover)1328791823(hardcover)(OCoLC)987617974823/.91223Tolkien, J. R. R.(John Ronald Reuel),1892-1973,author.Beren and Lúthien /by J.R.R. Tolkien ; edited by Christopher Tolkien ; with illustrations by Alan Lee.First U.S. edition.Boston :Houghton Mifflin Harcourt,2017.288 pages, 9 unnumbered leaves of plates :illustrations (some color) ;22 cm.texttxtrdacontentunmediatednrdamediavolumerdacarrierBeren was a mortal man, but Lúthien was an immortal elf. Her father, a great elvish lord, in deep opposition to Beren, imposed on him an impossible task that he must perform before he might wed Lúthien. To show something of the process whereby this legend of Middle-earth evolved over the years, Christopher Tolkien has told the story in his father's own words by giving, first, its original form, and then passages in prose and verse from later texts that illustrate the narrative as it changed. Presented together for the first time, they reveal aspects of the story, both in event and in narrative immediacy, that were afterwards lost.--From publisher's description.Middle Earth (Imaginary place)Fiction.ElvesFiction.Quests (Expeditions)Fiction.Good and evilFiction.Fantasy fiction.lcgftTolkien, Christopher,editor.Lee, Alan,illustrator.Tolkien, J. R. R.(John Ronald Reuel),1892-1973.Silmarillion. $$, 'PGTAP' ); INSERT INTO container.biblio_record_entry_bucket (id, owner, name, btype) VALUES (101, 1, 'Bookbag Bucket', 'bookbag'); INSERT INTO container.biblio_record_entry_bucket_item (id, bucket, target_biblio_record_entry) VALUES (101, 101, 60500); ----------------------------------- -- Test asset.merge_record_assets() ----------------------------------- SELECT is(asset.merge_record_assets(60501, 60500), 0, 'Record assets merged!'); -- check if bucket 101's entry 101 was updated to 60501 SELECT is( (SELECT target_biblio_record_entry from container.biblio_record_entry_bucket_item where id=101)::BIGINT, 60501::BIGINT, 'LP 1731960 asset.merge_record_assets() preserve book bag entries, bib bucket item 101 should be 60501' ); SELECT * FROM finish(); ROLLBACK;