From: Mike Rylander Date: Wed, 26 Oct 2011 17:05:17 +0000 (-0400) Subject: Upgrade script to populate authority.simple_heading X-Git-Tag: sprint4-merge-nov22~4884 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b00d34fc683698c37201b0966abaeafcabb75c23;p=working%2FEvergreen.git Upgrade script to populate authority.simple_heading Signed-off-by: Mike Rylander Signed-off-by: Thomas Berezansky --- 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; +