<?xml version="1.0" encoding="UTF-8"?><database name="egdb3_11_7" schema="container" type="PostgreSQL - 15.10 (Ubuntu 15.10-1.pgdg24.04+1)">
   <sequences>
      <sequence increment="1" name="biblio_record_entry_bucket_id_seq" startValue="1"/>
      <sequence increment="1" name="biblio_record_entry_bucket_item_id_seq" startValue="1"/>
      <sequence increment="1" name="biblio_record_entry_bucket_item_note_id_seq" startValue="1"/>
      <sequence increment="1" name="biblio_record_entry_bucket_note_id_seq" startValue="1"/>
      <sequence increment="1" name="call_number_bucket_id_seq" startValue="1"/>
      <sequence increment="1" name="call_number_bucket_item_id_seq" startValue="1"/>
      <sequence increment="1" name="call_number_bucket_item_note_id_seq" startValue="1"/>
      <sequence increment="1" name="call_number_bucket_note_id_seq" startValue="1"/>
      <sequence increment="1" name="carousel_id_seq" startValue="1"/>
      <sequence increment="1" name="carousel_org_unit_id_seq" startValue="1"/>
      <sequence increment="1" name="copy_bucket_id_seq" startValue="1"/>
      <sequence increment="1" name="copy_bucket_item_id_seq" startValue="1"/>
      <sequence increment="1" name="copy_bucket_item_note_id_seq" startValue="1"/>
      <sequence increment="1" name="copy_bucket_note_id_seq" startValue="1"/>
      <sequence increment="1" name="user_bucket_id_seq" startValue="1"/>
      <sequence increment="1" name="user_bucket_item_id_seq" startValue="1"/>
      <sequence increment="1" name="user_bucket_item_note_id_seq" startValue="1"/>
      <sequence increment="1" name="user_bucket_note_id_seq" startValue="1"/>
   </sequences>
   <tables>
      <table name="biblio_record_entry_bucket" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.biblio_record_entry_bucket_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="bucket" foreignKey="biblio_record_entry_bucket_item_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="biblio_record_entry_bucket_item"/>
            <child column="bucket" foreignKey="biblio_record_entry_bucket_note_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="biblio_record_entry_bucket_note"/>
            <child column="bucket" foreignKey="carousel_bucket_fkey" implied="false" onDeleteCascade="false" schema="container" table="carousel"/>
            <child column="container" foreignKey="session_container_fkey" implied="false" onDeleteCascade="false" schema="url_verify" table="session"/>
            <child column="match_bucket" foreignKey="match_bucket_fkey" implied="false" onDeleteCascade="false" schema="vandelay" table="bib_queue"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="owner" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="biblio_record_entry_bucket_owner_fkey" implied="false" onDeleteCascade="true" schema="actor" table="usr"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'misc'::text" digits="0" id="3" name="btype" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="code" foreignKey="biblio_record_entry_bucket_btype_fkey" implied="false" onDeleteCascade="false" schema="container" table="biblio_record_entry_bucket_type"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="5" name="pub" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="owning_lib" nullable="true" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="biblio_record_entry_bucket_owning_lib_fkey" implied="false" onDeleteCascade="true" schema="actor" table="org_unit"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="create_time" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="biblio_record_entry_bucket_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="breb_name_once_per_owner" unique="true">
            <column ascending="true" name="owner"/>
            <column ascending="true" name="name"/>
            <column ascending="true" name="btype"/>
         </index>
      </table>
      <table name="biblio_record_entry_bucket_item" numRows="85" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.biblio_record_entry_bucket_item_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="item" foreignKey="biblio_record_entry_bucket_item_note_item_fkey" implied="false" onDeleteCascade="true" schema="container" table="biblio_record_entry_bucket_item_note"/>
            <child column="item" foreignKey="url_item_fkey" implied="false" onDeleteCascade="false" schema="url_verify" table="url"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="bucket" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="biblio_record_entry_bucket_item_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="biblio_record_entry_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="target_biblio_record_entry" nullable="false" remarks="" size="19" type="int8" typeCode="-5">
            <parent column="id" foreignKey="biblio_record_entry_bucket_item_target_biblio_record_entry_fkey" implied="false" onDeleteCascade="true" schema="biblio" table="record_entry"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="pos" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="create_time" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="biblio_record_entry_bucket_item_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="biblio_record_entry_bucket_item_note" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.biblio_record_entry_bucket_item_note_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="item" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="biblio_record_entry_bucket_item_note_item_fkey" implied="false" onDeleteCascade="true" schema="container" table="biblio_record_entry_bucket_item"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="note" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="biblio_record_entry_bucket_item_note_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="biblio_record_entry_bucket_note" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.biblio_record_entry_bucket_note_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="bucket" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="biblio_record_entry_bucket_note_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="biblio_record_entry_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="note" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="biblio_record_entry_bucket_note_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="biblio_record_entry_bucket_type" remarks="" schema="container" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="code" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <child column="btype" foreignKey="biblio_record_entry_bucket_btype_fkey" implied="false" onDeleteCascade="false" schema="container" table="biblio_record_entry_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="label" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="code" sequenceNumberInPK="1"/>
         <index name="biblio_record_entry_bucket_type_pkey" unique="true">
            <column ascending="true" name="code"/>
         </index>
         <index name="biblio_record_entry_bucket_type_label_key" unique="true">
            <column ascending="true" name="label"/>
         </index>
      </table>
      <table name="call_number_bucket" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.call_number_bucket_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="bucket" foreignKey="call_number_bucket_item_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="call_number_bucket_item"/>
            <child column="bucket" foreignKey="call_number_bucket_note_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="call_number_bucket_note"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="owner" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="call_number_bucket_owner_fkey" implied="false" onDeleteCascade="true" schema="actor" table="usr"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'misc'::text" digits="0" id="3" name="btype" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="code" foreignKey="call_number_bucket_btype_fkey" implied="false" onDeleteCascade="false" schema="container" table="call_number_bucket_type"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="5" name="pub" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="owning_lib" nullable="true" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="call_number_bucket_owning_lib_fkey" implied="false" onDeleteCascade="true" schema="actor" table="org_unit"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="create_time" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="call_number_bucket_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="cnb_name_once_per_owner" unique="true">
            <column ascending="true" name="owner"/>
            <column ascending="true" name="name"/>
            <column ascending="true" name="btype"/>
         </index>
      </table>
      <table name="call_number_bucket_item" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.call_number_bucket_item_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="item" foreignKey="call_number_bucket_item_note_item_fkey" implied="false" onDeleteCascade="true" schema="container" table="call_number_bucket_item_note"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="bucket" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="call_number_bucket_item_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="call_number_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="target_call_number" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="call_number_bucket_item_target_call_number_fkey" implied="false" onDeleteCascade="true" schema="asset" table="call_number"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="pos" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="create_time" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="call_number_bucket_item_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="call_number_bucket_item_note" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.call_number_bucket_item_note_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="item" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="call_number_bucket_item_note_item_fkey" implied="false" onDeleteCascade="true" schema="container" table="call_number_bucket_item"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="note" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="call_number_bucket_item_note_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="call_number_bucket_note" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.call_number_bucket_note_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="bucket" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="call_number_bucket_note_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="call_number_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="note" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="call_number_bucket_note_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="call_number_bucket_type" remarks="" schema="container" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="code" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <child column="btype" foreignKey="call_number_bucket_btype_fkey" implied="false" onDeleteCascade="false" schema="container" table="call_number_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="label" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="code" sequenceNumberInPK="1"/>
         <index name="call_number_bucket_type_pkey" unique="true">
            <column ascending="true" name="code"/>
         </index>
         <index name="call_number_bucket_type_label_key" unique="true">
            <column ascending="true" name="label"/>
         </index>
      </table>
      <table name="carousel" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.carousel_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="carousel" foreignKey="carousel_org_unit_carousel_fkey" implied="false" onDeleteCascade="true" schema="container" table="carousel_org_unit"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="type" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="carousel_type_fkey" implied="false" onDeleteCascade="false" schema="config" table="carousel_type"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="owner" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="carousel_owner_fkey" implied="false" onDeleteCascade="false" schema="actor" table="org_unit"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="bucket" nullable="true" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="carousel_bucket_fkey" implied="false" onDeleteCascade="false" schema="container" table="biblio_record_entry_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="5" name="creator" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="carousel_creator_fkey" implied="false" onDeleteCascade="false" schema="actor" table="usr"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="editor" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="carousel_editor_fkey" implied="false" onDeleteCascade="false" schema="actor" table="usr"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="create_time" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="8" name="edit_time" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="9" name="age_filter" nullable="true" remarks="" size="49" type="interval" typeCode="1111"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="10" name="owning_lib_filter" nullable="true" remarks="" size="10" type="_int4" typeCode="2003"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="11" name="copy_location_filter" nullable="true" remarks="" size="10" type="_int4" typeCode="2003"/>
         <column autoUpdated="false" defaultValue="null" digits="6" id="12" name="last_refresh_time" nullable="true" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <column autoUpdated="false" defaultValue="true" digits="0" id="13" name="active" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="14" name="max_items" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="carousel_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="carousel_org_unit" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.carousel_org_unit_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="carousel" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="carousel_org_unit_carousel_fkey" implied="false" onDeleteCascade="true" schema="container" table="carousel"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="override_name" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="org_unit" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="carousel_org_unit_org_unit_fkey" implied="false" onDeleteCascade="false" schema="actor" table="org_unit"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="seq" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="carousel_org_unit_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="copy_bucket" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.copy_bucket_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="bucket" foreignKey="copy_bucket_item_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="copy_bucket_item"/>
            <child column="bucket" foreignKey="copy_bucket_note_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="copy_bucket_note"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="owner" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="copy_bucket_owner_fkey" implied="false" onDeleteCascade="true" schema="actor" table="usr"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'misc'::text" digits="0" id="3" name="btype" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="code" foreignKey="copy_bucket_btype_fkey" implied="false" onDeleteCascade="false" schema="container" table="copy_bucket_type"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="5" name="pub" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="owning_lib" nullable="true" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="copy_bucket_owning_lib_fkey" implied="false" onDeleteCascade="true" schema="actor" table="org_unit"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="create_time" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="copy_bucket_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="cb_name_once_per_owner" unique="true">
            <column ascending="true" name="owner"/>
            <column ascending="true" name="name"/>
            <column ascending="true" name="btype"/>
         </index>
      </table>
      <table name="copy_bucket_item" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.copy_bucket_item_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="item" foreignKey="copy_bucket_item_note_item_fkey" implied="false" onDeleteCascade="true" schema="container" table="copy_bucket_item_note"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="bucket" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="copy_bucket_item_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="copy_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="target_copy" nullable="false" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="pos" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="create_time" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="copy_bucket_item_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="copy_bucket_item_bucket_idx" unique="false">
            <column ascending="true" name="bucket"/>
         </index>
      </table>
      <table name="copy_bucket_item_note" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.copy_bucket_item_note_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="item" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="copy_bucket_item_note_item_fkey" implied="false" onDeleteCascade="true" schema="container" table="copy_bucket_item"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="note" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="copy_bucket_item_note_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="copy_bucket_note" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.copy_bucket_note_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="bucket" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="copy_bucket_note_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="copy_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="note" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="copy_bucket_note_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="copy_bucket_type" remarks="" schema="container" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="code" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <child column="btype" foreignKey="copy_bucket_btype_fkey" implied="false" onDeleteCascade="false" schema="container" table="copy_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="label" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="code" sequenceNumberInPK="1"/>
         <index name="copy_bucket_type_pkey" unique="true">
            <column ascending="true" name="code"/>
         </index>
         <index name="copy_bucket_type_label_key" unique="true">
            <column ascending="true" name="label"/>
         </index>
      </table>
      <table name="user_bucket" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.user_bucket_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="bucket" foreignKey="batch_hold_event_bucket_fkey" implied="false" onDeleteCascade="true" schema="action" table="batch_hold_event"/>
            <child column="bucket" foreignKey="user_bucket_item_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="user_bucket_item"/>
            <child column="bucket" foreignKey="user_bucket_note_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="user_bucket_note"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="owner" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="user_bucket_owner_fkey" implied="false" onDeleteCascade="true" schema="actor" table="usr"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="name" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="'misc'::text" digits="0" id="3" name="btype" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <parent column="code" foreignKey="user_bucket_btype_fkey" implied="false" onDeleteCascade="false" schema="container" table="user_bucket_type"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="4" name="description" nullable="true" remarks="" size="2147483647" type="text" typeCode="12"/>
         <column autoUpdated="false" defaultValue="false" digits="0" id="5" name="pub" nullable="false" remarks="" size="1" type="bool" typeCode="-7"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="6" name="owning_lib" nullable="true" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="user_bucket_owning_lib_fkey" implied="false" onDeleteCascade="true" schema="actor" table="org_unit"/>
         </column>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="7" name="create_time" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="user_bucket_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="ub_name_once_per_owner" unique="true">
            <column ascending="true" name="owner"/>
            <column ascending="true" name="name"/>
            <column ascending="true" name="btype"/>
         </index>
      </table>
      <table name="user_bucket_item" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.user_bucket_item_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4">
            <child column="item" foreignKey="user_bucket_item_note_item_fkey" implied="false" onDeleteCascade="true" schema="container" table="user_bucket_item_note"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="bucket" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="user_bucket_item_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="user_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="target_user" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="user_bucket_item_target_user_fkey" implied="false" onDeleteCascade="true" schema="actor" table="usr"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="3" name="pos" nullable="true" remarks="" size="10" type="int4" typeCode="4"/>
         <column autoUpdated="false" defaultValue="now()" digits="6" id="4" name="create_time" nullable="false" remarks="" size="35" type="timestamptz" typeCode="93"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="user_bucket_item_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
         <index name="user_bucket_item_target_user_idx" unique="false">
            <column ascending="true" name="target_user"/>
         </index>
      </table>
      <table name="user_bucket_item_note" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.user_bucket_item_note_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="item" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="user_bucket_item_note_item_fkey" implied="false" onDeleteCascade="true" schema="container" table="user_bucket_item"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="note" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="user_bucket_item_note_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="user_bucket_note" remarks="" schema="container" type="TABLE">
         <column autoUpdated="true" defaultValue="nextval('container.user_bucket_note_id_seq'::regclass)" digits="0" id="0" name="id" nullable="false" remarks="" size="10" type="serial" typeCode="4"/>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="bucket" nullable="false" remarks="" size="10" type="int4" typeCode="4">
            <parent column="id" foreignKey="user_bucket_note_bucket_fkey" implied="false" onDeleteCascade="true" schema="container" table="user_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="2" name="note" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="id" sequenceNumberInPK="1"/>
         <index name="user_bucket_note_pkey" unique="true">
            <column ascending="true" name="id"/>
         </index>
      </table>
      <table name="user_bucket_type" remarks="" schema="container" type="TABLE">
         <column autoUpdated="false" defaultValue="null" digits="0" id="0" name="code" nullable="false" remarks="" size="2147483647" type="text" typeCode="12">
            <child column="btype" foreignKey="user_bucket_btype_fkey" implied="false" onDeleteCascade="false" schema="container" table="user_bucket"/>
         </column>
         <column autoUpdated="false" defaultValue="null" digits="0" id="1" name="label" nullable="false" remarks="" size="2147483647" type="text" typeCode="12"/>
         <primaryKey column="code" sequenceNumberInPK="1"/>
         <index name="user_bucket_type_pkey" unique="true">
            <column ascending="true" name="code"/>
         </index>
         <index name="user_bucket_type_label_key" unique="true">
            <column ascending="true" name="label"/>
         </index>
      </table>
   </tables>
   <routines>
      <routine dataAccess="MODIFIES" deterministic="false" name="clear_all_expired_circ_history_items()" returnType="void" securityType="INVOKER" type="FUNCTION">
         <comment><![CDATA[Delete expired circulation bucket items for all users that have
a setting for patron.max_reading_list_interval.]]></comment>
         <definition language="plpgsql"><![CDATA[--
-- Delete expired circulation bucket items for all users that have
-- a setting for patron.max_reading_list_interval.
--
DECLARE
    today        TIMESTAMP WITH TIME ZONE;
    threshold    TIMESTAMP WITH TIME ZONE;
	usr_setting  RECORD;
BEGIN
	SELECT date_trunc( 'day', now() ) INTO today;
	--
	FOR usr_setting in
		SELECT
			usr,
			value
		FROM
			actor.usr_setting
		WHERE
			name = 'patron.max_reading_list_interval'
	LOOP
		--
		-- Make sure the setting is a valid interval
		--
		BEGIN
			threshold := today - CAST( translate( usr_setting.value, '"', '' ) AS INTERVAL );
		EXCEPTION
			WHEN OTHERS THEN
				RAISE NOTICE 'Invalid setting patron.max_reading_list_interval for user %: ''%''',
					usr_setting.usr, usr_setting.value;
				CONTINUE;
		END;
		--
		--RAISE NOTICE 'User % threshold %', usr_setting.usr, threshold;
		--
    	DELETE FROM container.copy_bucket_item
    	WHERE
        	bucket IN
        	(
        	    SELECT
        	        id
        	    FROM
        	        container.copy_bucket
        	    WHERE
        	        owner = usr_setting.usr
        	        AND btype = 'circ_history'
        	)
        	AND create_time < threshold;
	END LOOP;
	--
END;]]></definition>
         <parameters>
            <parameter mode="IN"/>
         </parameters>
      </routine>
      <routine dataAccess="MODIFIES" deterministic="false" name="clear_expired_circ_history_items(ac_usr integer)" returnType="void" securityType="INVOKER" type="FUNCTION">
         <comment><![CDATA[Delete old circulation bucket items for a specified user.
"Old" means older than the interval specified by a
user-level setting, if it is so specified.]]></comment>
         <definition language="plpgsql"><![CDATA[--
-- Delete old circulation bucket items for a specified user.
-- "Old" means older than the interval specified by a
-- user-level setting, if it is so specified.
--
DECLARE
    threshold TIMESTAMP WITH TIME ZONE;
BEGIN
	-- Sanity check
	IF ac_usr IS NULL THEN
		RETURN;
	END IF;
	-- Determine the threshold date that defines "old".  Subtract the
	-- interval from the system date, then truncate to midnight.
	SELECT
		date_trunc( 
			'day',
			now() - CAST( translate( value, '"', '' ) AS INTERVAL )
		)
	INTO
		threshold
	FROM
		actor.usr_setting
	WHERE
		usr = ac_usr
		AND name = 'patron.max_reading_list_interval';
	--
	IF threshold is null THEN
		-- No interval defined; don't delete anything
		-- RAISE NOTICE 'No interval defined for user %', ac_usr;
		return;
	END IF;
	--
	-- RAISE NOTICE 'Date threshold: %', threshold;
	--
	-- Threshold found; do the delete
	delete from container.copy_bucket_item
	where
		bucket in
		(
			select
				id
			from
				container.copy_bucket
			where
				owner = ac_usr
				and btype = 'circ_history'
		)
		and create_time < threshold;
	--
	RETURN;
END;]]></definition>
         <parameters>
            <parameter mode="IN" name="ac_usr" type="integer"/>
         </parameters>
      </routine>
   </routines>
</database>
