2 SELECT evergreen.populate_call_number(4, 'ML 2533 B34 C', 'IMPORT CONCERTO', 3); -- BR1
3 SELECT evergreen.populate_call_number(5, 'ML1263F', 'IMPORT CONCERTO', 3); -- BR2
4 SELECT evergreen.populate_call_number(6, 'MT130M8 G', 'IMPORT CONCERTO', 3); -- BR3
5 SELECT evergreen.populate_call_number(7, 'ML 60 R', 'IMPORT CONCERTO', 3); -- BR4
6 SELECT evergreen.populate_call_number(9, 'MT 125 .H667 C', 'IMPORT CONCERTO', 3); -- BM1
7 SELECT evergreen.populate_call_number(4, '780 B', 'IMPORT CONCERTO', 2); -- BR1
8 SELECT evergreen.populate_call_number(5, '780 A', 'IMPORT CONCERTO', 2); -- BR2
9 SELECT evergreen.populate_call_number(6, '781 D', 'IMPORT CONCERTO', 2); -- BR3
10 SELECT evergreen.populate_call_number(7, '781 G', 'IMPORT CONCERTO', 2); -- BR4
11 SELECT evergreen.populate_call_number(9, '780 R', 'IMPORT CONCERTO', 2); -- BM1
14 SELECT evergreen.populate_copy(4, 4, 'CONC40000', 'M'); -- BR1
15 SELECT evergreen.populate_copy(5, 5, 'CONC50000', 'M'); -- BR2
16 SELECT evergreen.populate_copy(6, 6, 'CONC60000', 'M'); -- BR3
17 SELECT evergreen.populate_copy(7, 7, 'CONC70000', 'M'); -- BR4
18 SELECT evergreen.populate_copy(9, 9, 'CONC90000', 'M'); -- BM1
20 SELECT evergreen.populate_copy(4, 4, 'CONC41000', 'M'); -- BR1
21 SELECT evergreen.populate_copy(5, 5, 'CONC51000', 'M'); -- BR2
22 SELECT evergreen.populate_copy(6, 6, 'CONC61000', 'M'); -- BR3
23 SELECT evergreen.populate_copy(7, 7, 'CONC71000', 'M'); -- BR4
24 SELECT evergreen.populate_copy(9, 9, 'CONC91000', 'M'); -- BM1
26 SELECT evergreen.populate_copy(4, 4, 'CONC42000', 'M'); -- BR1
27 SELECT evergreen.populate_copy(5, 5, 'CONC52000', 'M'); -- BR2
28 SELECT evergreen.populate_copy(6, 6, 'CONC62000', 'M'); -- BR3
29 SELECT evergreen.populate_copy(7, 7, 'CONC72000', 'M'); -- BR4
30 SELECT evergreen.populate_copy(9, 9, 'CONC92000', 'M'); -- BM1
32 SELECT evergreen.populate_copy(4, 4, 'CONC43000', 'M'); -- BR1
33 SELECT evergreen.populate_copy(5, 5, 'CONC53000', 'M'); -- BR2
34 SELECT evergreen.populate_copy(6, 6, 'CONC63000', 'M'); -- BR3
35 SELECT evergreen.populate_copy(7, 7, 'CONC73000', 'M'); -- BR4
36 SELECT evergreen.populate_copy(9, 9, 'CONC93000', 'M'); -- BM1
38 SELECT evergreen.populate_copy(4, 4, 'CONC44000', 'M'); -- BR1
39 SELECT evergreen.populate_copy(5, 5, 'CONC54000', 'M'); -- BR2
40 SELECT evergreen.populate_copy(6, 6, 'CONC64000', 'M'); -- BR3
41 SELECT evergreen.populate_copy(7, 7, 'CONC74000', 'M'); -- BR4
42 SELECT evergreen.populate_copy(9, 9, 'CONC94000', 'M'); -- BM1
44 SELECT evergreen.populate_copy(4, 4, 'CONC40000', '780'); -- BR1
45 SELECT evergreen.populate_copy(5, 5, 'CONC50000', '780'); -- BR2
46 SELECT evergreen.populate_copy(6, 6, 'CONC60000', '780'); -- BR3
47 SELECT evergreen.populate_copy(7, 7, 'CONC70000', '780'); -- BR4
48 SELECT evergreen.populate_copy(9, 9, 'CONC90000', '780'); -- BM1
50 SELECT evergreen.populate_copy(4, 4, 'CONC41000', '780'); -- BR1
51 SELECT evergreen.populate_copy(5, 5, 'CONC51000', '780'); -- BR2
52 SELECT evergreen.populate_copy(6, 6, 'CONC61000', '780'); -- BR3
53 SELECT evergreen.populate_copy(7, 7, 'CONC71000', '780'); -- BR4
54 SELECT evergreen.populate_copy(9, 9, 'CONC91000', '780'); -- BM1
56 -- Delete some copies, call numbers, and bib records
57 DELETE FROM biblio.record_entry
60 DELETE FROM asset.call_number
61 WHERE record IN (30, 40) AND owning_lib = 4;
63 DELETE FROM asset.copy
64 WHERE call_number IN (
65 SELECT id FROM asset.call_number
66 WHERE record IN (50, 60)
69 -- Add some prefixes and suffixes
70 INSERT INTO asset.call_number_prefix (owning_lib, label) VALUES
71 (4, 'REF BR1'), (5, 'DVD BR2'), (7, 'STORAGE BR4');
73 INSERT INTO asset.call_number_suffix (owning_lib, label) VALUES
74 (4, 'REFERENCE'), (5, 'MEDIA'), (7, 'DEPOSITORY');
76 -- Some call numbers will have both prefixes and suffixes
77 UPDATE asset.call_number
78 SET prefix = 1, suffix = 1
79 WHERE owning_lib = 4 AND record IN (35, 45);
81 UPDATE asset.call_number
82 SET prefix = 2, suffix = 2
83 WHERE owning_lib = 5 AND record IN (55, 65);
85 -- Some call numbers will have either a prefix or a suffix
86 UPDATE asset.call_number
88 WHERE owning_lib = 7 AND record IN (75);
90 UPDATE asset.call_number
92 WHERE owning_lib = 7 AND record IN (85);
94 -- Create some bibliographic parts
95 INSERT INTO biblio.monograph_part (record, label) VALUES
96 -- "Virtuoso wind concertos"
97 (84, 'DISC 1'), (84, 'DISC 2'), (84, 'DISC 3'), (84, 'DISC 4'),
98 -- "6 double concertos"
99 (53, 'DISC 1'), (53, 'DISC 2'), (53, 'DISC 3'), (53, 'DISC 4');
101 -- Create additional copies for the parts
102 INSERT INTO asset.copy (call_number, circ_lib, creator, editor, loan_duration, fine_level, barcode)
103 SELECT id, owning_lib, 1, 1, 1, 1, 'CONC70001' || id::text
104 FROM asset.call_number
105 WHERE record IN (53, 84) AND label LIKE 'M%' AND owning_lib = 7;
107 INSERT INTO asset.copy (call_number, circ_lib, creator, editor, loan_duration, fine_level, barcode)
108 SELECT id, owning_lib, 1, 1, 1, 1, 'CONC70002' || id::text
109 FROM asset.call_number
110 WHERE record IN (53, 84) AND label LIKE '78%' AND owning_lib = 7;
112 -- Assign the copies to the parts
113 INSERT INTO asset.copy_part_map (target_copy, part)
114 SELECT DISTINCT ON (ac.id) ac.id, bmp.id
115 FROM asset.copy ac INNER JOIN asset.call_number acn
116 ON ac.call_number = acn.id
117 INNER JOIN biblio.monograph_part bmp
118 ON acn.record = bmp.record
119 WHERE bmp.record IN (53, 84)
122 -- Create some conjoined items:
123 -- Create a new conjoined item type
124 INSERT INTO biblio.peer_type (name)
125 VALUES ('Media player');
127 -- Create additional copies for the conjoined items
128 INSERT INTO asset.copy (call_number, circ_lib, creator, editor, loan_duration, fine_level, barcode)
129 SELECT id, owning_lib, 1, 1, 1, 1, 'PEERBIB' || record::text
130 FROM asset.call_number
131 WHERE record = 15 AND label LIKE 'M%' AND owning_lib = 4;
133 -- Create the peer bib copy map
134 INSERT INTO biblio.peer_bib_copy_map (peer_type, peer_record, target_copy)
135 SELECT bpt.id, acn.record, ac.id
136 FROM biblio.peer_type bpt
137 INNER JOIN asset.copy ac ON bpt.name = 'Media player'
138 INNER JOIN asset.call_number acn ON ac.barcode LIKE 'PEERBIB%'
140 AND acn.record IN (24, 93, 97, 100)
141 GROUP BY bpt.id, acn.record, ac.id;