From b00d34fc683698c37201b0966abaeafcabb75c23 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 26 Oct 2011 13:05:17 -0400 Subject: [PATCH] Upgrade script to populate authority.simple_heading Signed-off-by: Mike Rylander Signed-off-by: Thomas Berezansky --- ...XXXX.data.populate_authority_simple_heading.sql | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.populate_authority_simple_heading.sql diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.populate_authority_simple_heading.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.populate_authority_simple_heading.sql new file mode 100644 index 0000000000..c42cb85b08 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.populate_authority_simple_heading.sql @@ -0,0 +1,23 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +DO $$ +DECLARE x TEXT; +BEGIN + + FOR x IN + SELECT marc + FROM authority.record_entry + WHERE id > 0 + AND NOT deleted + AND id NOT IN (SELECT DISTINCT record FROM authority.simple_heading) + LOOP + INSERT INTO authority.simple_heading (record,atag,value,sort_value) + SELECT record, atag, value, sort_value FROM authority.simple_heading_set(x); + END LOOP; +END; +$$; + +COMMIT; + -- 2.11.0